Friday, 22 April 2016

Checked vs. Unchecked exceptions


All predefined exceptions in Java are either a checked exception or an unchecked exception.

Checked exceptions must be caught using try / catch block or we should throw the exception using throws clause.
If you don't, compilation of program will fail.

Object
     |---- Throwable
                   |---- Error       |----- Exception (checked)
                                                             |----- RuntimeException (unchecked)

No comments:

Post a Comment

Note: only a member of this blog may post a comment.