Wednesday, 1 February 2017

CATEGORIES OF EXCEPTIONS IN JAVA

There are two categories of exceptions –

1. Checked Exceptions – The checked exceptions are recognized by the compiler. In the Exception Hierarchy, except the Runtime Exception and its subclasses errors all the remaining exceptions are called Checked Exceptions.
Example – FileNotFoundException, InterruptedException, IOException etc.

2.Unchecked Exceptions – The unchecked exceptions are not recognized by the compiler. They can occur suddenly. In the Exception Hierarchy, the Runtime Exception and all its subclasses are called unchecked exceptions.
Example – NullPointerException, ArithmeticException, ClassCastException, ArrayIndexOutOfBoundsException etc.

No comments:

Post a Comment