Exception 2
Exception 2
try{
}catch(Exception_class_Name ref){}
try{
}finally{}
Test it Now
Output:
As displayed in the above example, rest of the code is not executed (in such case, rest of the code...
statement is not printed).
There can be 100 lines of code after exception. So all the code after exception will not be executed.
try{
int data=50/0;
}catch(ArithmeticException e){System.out.println(e);}
Test it Now
Output:
Now, as displayed in the above example, rest of the code is executed i.e. rest of the code...
statement is printed.
Prints the stack trace (Hierarchy of methods where the exception occurred).
But if exception is handled by the application programmer, normal flow of the application is
maintained i.e. rest of the code is executed.
← prev next →
Please Share
Latest 4 Tutorials
ADO.NET