PUB ID

Tuesday, 5 January 2016

Difference between checked and unchecked exceptions?


1) Checked Exception The classes that extend Throwable class except RuntimeException and Error are known as checked exceptions e.g.IOException, SQLException etc. Checked exceptions are checked at compile-time.
2) Unchecked Exception The classes that extend RuntimeException are known as unchecked exceptions e.g. ArithmeticException, NullPointerException, ArrayIndexOutOfBoundsException etc. Unchecked exceptions are not checked at compile-time rather they are checked at runtime.
3) Error Error is irrecoverable e.g. OutOfMemoryError, VirtualMachineError, AssertionError etc.

No comments:

Post a Comment