ways to handle exceptions in java code example

Example 1: exceptions you get in java

Unchecked:
-IndexOutOfBounds exception(while working with arrays/strings)
-NullPointerException(if I forget to instantiate the objects)
-ArithmaticException

Checked:
-IOException
-SQLException
-FileNotFountException

Example 2: how many ways we can do exception handling in java

We can handle exceptions in either of the two ways :
1) By specifying try catch block where we can catch the exception.
2) Declaring a method with throws clause

Tags:

Java Example