Checked Exceptions
The exceptions which are checked by the compiler for smooth execution of the program at runtime are called, checked exceptions.
example:-
FileNotFoundException,ServletException etc.
In our java program, if there is a possibility of rising checked exception then mandatory we should handle that checked exception (either by try catch or throws keyword) otherwise, we will get compile time error.
Unchecked Exceptions
The exceptions which are not checked by the compiler whether the programmer is handling or not, such type of exceptions are called Unchecked Exceptions.
example:-
ArithmaticException, ArrayIndexOutOfBoundException , NullPointerException etc
Note: 1. Whether it is checked or unchecked, every exception occurs at runtime only there is no chance of occurring any exception at compile-time.
2. RuntimeException and it's child class, Error and it's child classes are unchecked except these remaining are checked.
Fully checked v/s Partially checked
- A checked exception is said to be fully checked if and only if all its child classes also checked.
IOException
InterruptedException
ServletException
- A checked exception is said to be partially checked if and only if some of its child classes are unchecked.
Exception
Throwable
Note: The Only possible partially checked exceptions in java are:-
- Throwable
- Exception
No comments:
Post a Comment
Be the first to comment!
Don't just read and walk away, Your Feedback Is Always Appreciated. I will try to reply to your queries as soon as time allows.
Note:
1. If your question is unrelated to this article, please use our Facebook Page.
2. Please always make use of your name in the comment box instead of anonymous so that i can respond to you through your name and don't make use of Names such as "Admin" or "ADMIN" if you want your Comment to be published.
Regards,
JavaByChetan
Back To Home