Exception Handling in Java
The exception handling in java is a mechanism to handle the runtime errors, that occurs a lot for a beginner, so that actual programme of the application can be maintained.
We will learn about java exception, its type and the basic difference between checked and unchecked exceptions.


In java, exception is an event that disrupts and distracts the actual path of the program. It is an error which is thrown at runtime.

Exception handling?
Exception Handling is a way to handle runtime errors such as ClassNotFound, IO, SQL, Remote etc.
Benefits of Exception Handling
The main benefit of exception handling is to handle the actual path of the application. Exception normally disrupts the actual path of the application that is why we use exception handling.
1. statement 1;
2. statement 2;
3. statement 3;
4. statement 4;
5. statement 5;//exception occurs
6. statement 6;
7. statement 7;
8. statement 8;
9. statement 9;
10. statement 10;

Suppose there is 10 statements in users program and there occurs an exception at statement 5, rest of the code will not be executed i.e. statement 6 to 10 will not run. If we perform exception handling, rest of the statement will be executed. That is why we use exception handling in java.

Facebook Comments


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.