Java Exception

In Java, there are two types of exception:

1)Checked: are the exceptions that are checked at compile time. If some code within a method throws a checked exception, the the method must either handle the exception or it must specify the exception using throws keyword.

2)Unchecked are the exceptions that are not checked at compile time. In C++, all exceptions are unchecked, so it is not forced by the compiler to either handle or specify the exception. It is up to programmers to be civilized, and specify or catch the exceptions.

In Java exceptions under Error and RuntimeException classes are unchecked exception, everything else under throwable is checked.

Written on 07 August 2016