1/9/15

Difference Between Checked and Unchecked Exceptions

Checked Exception

Are those which can be caught at compile time.
Example - FileNotFound exception

If some file that you are trying to read is not present at given location. At compile time, java compiler will throw that exception to your code.

Unchecked Exceptions

Are those which can be caught at runtime only.
Example - NullPointer Exception

Unchecked exceptions are thrown by JVM at runtime. JVM  will throw Exception object that you need to catch using Try and Catch blocks in your code.