What are Java's Built-in Exceptions

What are Java's Built-in Exceptions

Exceptions subclassing RuntimeException need not be included in any method's throws list. These are called unchecked exceptions.

The unchecked exceptions defined in java.lang are listed in the following table.

ExceptionMeaning
ArithmeticExceptionArithmetic error, such as divide-by-zero.
ArrayIndexOutOfBoundsExceptionArray index is out-of-bounds.
ArrayStoreExceptionAssignment to an array element of an incompatible type.
ClassCastExceptionInvalid cast.
EnumConstantNotPresentExceptionAn attempt is made to use an undefined enumeration value.
IllegalArgumentExceptionIllegal argument used to invoke a method.
IllegalMonitorStateExceptionIllegal monitor operation, such as waiting on an unlocked thread.
IllegalStateExceptionEnvironment or application is in incorrect state.
IllegalThreadStateExceptionRequested operation not compatible with current thread state.
IndexOutOfBoundsExceptionSome type of index is out-of-bounds.
NegativeArraySizeExceptionArray created with a negative size.
NullPointerExceptionInvalid use of a null reference.
NumberFormatExceptionInvalid conversion of a string to a numeric format.
SecurityExceptionAttempt to violate security.
StringIndexOutOfBoundsAttempt to index outside the bounds of a string.
TypeNotPresentExceptionType not found.
UnsupportedOperationExceptionAn unsupported operation was encountered.

The checked exceptions are listed in the following table.

ExceptionMeaning
ClassNotFoundExceptionClass not found.
CloneNotSupportedExceptionAttempt to clone an object that does not implement the Cloneable interface.
IllegalAccessExceptionAccess to a class is denied.
InstantiationExceptionAttempt to create an object of an abstract class or interface.
InterruptedExceptionOne thread has been interrupted by another thread.
NoSuchFieldExceptionA requested field does not exist.
NoSuchMethodExceptionA requested method does not exist.




















Home »
  Java Tutorial »
    Java Language »




Java Data Type, Operator
Java Statement
Java Class
Java Array
Java Exception Handling
Java Annotations
Java Generics
Java Data Structures