Wednesday, 18 January 2012
Do you like this Article?
In Java, there are lots of sub-classes under java.lang.Exception class. we can divide these sub-classes into 2 types on the basis of compile-time checking.
The types are - Checked Exception & Unchecked Exception.
- Except RuntimeException( java.lang.RuntimeException) class, all sub-classes of Exception are checked exception.
- These exceptions need to include in a method's throws list, because these are checked by the compiler during compile time if a method handles or throws these exception.
- RuntimeException and its sub-classes are called as unchecked exception.
- We don't need to include in a method's throws list, because these are not checked by the compiler during compile time.