Java Common Unchecked Exceptions

There are some common unchecked exceptions occur in day to day java programming. Here we are going to see scenarios when those unchecked exceptions may occur.

1) NullPointerException

When access methods or variables on a null reference then throws NullPointerException

2) ArithmeticException

When an integer “divide by zero” throws ArithmeticException.

3) NumberFormatException 

When we try to convert string into a numeric value such as float or integer or long but the format of the input string is not appropriate or illegal.

4) ArrayIndexOutOfBoundsException

When access illegal index of an array

5) StringIndexOutOfBoundsException

When access illegal index of String with it’s methods

6) IllegalArgumentException

When a method has been called by passing an illegal or inappropriate argument

7) IllegalStateException

When a method has been invoked either at illegal or inappropriate time

8) ClassCastException

Thrown to indicate that the code has attempted to cast an object to a subclass of which it is not an instance.

Scroll to Top