+ 3

What is Exception handling?

describe it...

11th Nov 2017, 4:56 PM
Vivek Katole
8 Answers
+ 11
Exception handling is a way to make sure ur code doesn't crash when something unexpected occurs. For example u have a code that takes 2 input and returns their division e.g int x = sc.nextInt(); int y = sc.nextInt(); int result = x/y; An exception occurs if y=0(Arithmetic exception) which will cause the code to crash if not handled. To handle: try { int x = sc.nextInt(); int y = sc.nextInt(); int result = x/y; } catch(ArithmeticException e){ System.out.println("Division by zero"); }
11th Nov 2017, 9:15 PM
David Akhihiero
David Akhihiero - avatar
+ 6
alters the normal flow of program execution...!! ie disburbance😅😅
11th Nov 2017, 9:46 PM
Devanshi Patel
Devanshi Patel - avatar
+ 3
you decide what program do when an error occur
11th Nov 2017, 7:59 PM
Ahmad Abdolmaleki
Ahmad Abdolmaleki - avatar
+ 2
they can prevent programs from crashing
11th Nov 2017, 5:21 PM
Eligijus Silkartas
Eligijus Silkartas - avatar
+ 1
Use "try ... catch ..." to control the exception, otherwise you will get an error.
11th Nov 2017, 5:24 PM
Francisco Fuertes
Francisco Fuertes - avatar
+ 1
if you have large code in file and got exception then handle by try catch. ..no need to read whole code by compiler.. it makes efficiency in programming.
12th Nov 2017, 10:14 AM
Rkumar
Rkumar - avatar
+ 1
unwanted event occurce unexcceptly to disturbs the flow of program is called exception
12th Nov 2017, 12:53 PM
veeresh GB
veeresh GB - avatar
0
thanks...
14th Nov 2017, 2:04 PM
Vivek Katole