Unchecked exceptions in RuntimeException class in Java

Unchecked exceptions are the ones for which the compiler never checks if the exception is handled by a method or thrown.

RunTImeException class contains the pre defined run time exceptions. Here are the unchecked exceptions in Unchecked RuntimeException:

  • SecurityException: For violating security.
  • NullPointerException: Used for invalid use of null reference.
  • ArithmeticException: For Arithmetic exception.
  • IndexOutOfBoundsException: For index out of bounds.
  • StringIndexOutOfBounds: For index out of bounds of string.
  • ArrayIndexOutOfBoundsException: For Array index out of bounds.
  • ArrayStoreException: For Assigning an array element whose type is not compatible.
  • NegativeArraySizeException: Used when an array is created with negative size.
  • ClassCastException: For invalid cast.
  • IllegalArgumentException: Used when illegal argument is used to call a method.
  • IllegalMonitorStateException: For illegal monitor operation.
  • IllegalStateException: For illegal application state.
  • IllegalThreadStateException: Used when an operation is not compatible with current thread state.
  • NumberFormatException: Used when there is an invalid conversion of string to numeric format.
  • UnsupportedOperationException: For unsupported operation.

Leave a Reply