An exception is any unwanted thing which may interrupt the control flow of the program.
Types of Exceptions
There are mainly 2 types of Exceptions – checked or unchecked.
Exceptions that are checked at compile time. If some code within a method throws a checked exception, then the method must either handle the exception or it must specify the exception using throws keyword.
exceptions that are not checked at the compiled time.
In Java exceptions under Error and RuntimeException classes are unchecked exceptions, everything else under throwable is checked.
How to Handle Exception
They are handled by 5 keywords.