Types of exception

Java defines several type of Exception. Also in Java we can create our own custom exception.
See below screenshot for more clearification.

Below is the list of few exceptions in Java.

    • ClassNotFoundException
      This exception occurs when we try to access a class whose definition is not exist.
    • IOException
      This exception occurs when an I/O(Input-Output) operation failed.
    • SQLException
      This exception occurs when there is any database access error or other error.
    • RuntimeException
      This exception occurs during runtime.
    • NullPointerException
      This exception occurs when we point or refer any null value.
    • ArithmeticException
      This exception occurs when any exceptional condition arise during arithmetic operation.
    • NumberFormatException
      This exception occurs when we try to convert a string into number format.
    • IndexOutOfBoundException
      This exception occurs when index of any array is beyond the range of the array or the string.