Solution:
In Java there are 2 type of Exceptions, checked and unchecked.
The checked exceptions are checked at compile and they must be either handled in a catch
block, or they must be specified in the throws
section of the method. The checked exceptions are subclasses of the Exceptions
class and some of the most common exceptions of this type are: IOException
, SQLException
, ClassNotFoundException
etc.
The unchecked Exceptions are not checked at compile time and don't have to be handled in a catch
block or declared in the throws
section of the method. The unchecked Exceptions are subclasses of the RuntimeException
and some of the most common exceptions of this type are: IllegalArgumentException
, NullPointerException
, IllegalStateException
.