Built-in Exceptions in Java

Java Programming Java8Object Oriented Programming

Java defines several exception classes inside the standard package java.lang.

The most general of these exceptions are subclasses of the standard type RuntimeException. Since java.lang is implicitly imported into all Java programs, most exceptions derived from RuntimeException are automatically available.

Java defines several other types of exceptions that relate to its various class libraries. Following is the list of Java Unchecked RuntimeException.

Sr.No.
Exception & Description
1ArithmeticException
Arithmetic error, such as divide-by-zero.
2ArrayIndexOutOfBoundsException
Array index is out-of-bounds.
3ArrayStoreException
Assignment to an array element of an incompatible type.
4ClassCastException
Invalid cast.
5IllegalArgumentException
The illegal argument used to invoke a method.
6IllegalMonitorStateException
Illegal monitor operation, such as waiting on an unlocked thread.
7IllegalStateException
Environment or application is in an incorrect state.
8IllegalThreadStateException
Requested operation not compatible with the current thread state.
9IndexOutOfBoundsException
Some type of index is out-of-bounds.
10NegativeArraySizeException
The array created with a negative size.
11NullPointerException
Invalid use of a null reference.
12NumberFormatException
Invalid conversion of a string to a numeric format.
13SecurityException
Attempt to violate security.
14StringIndexOutOfBounds
Attempt to index outside the bounds of a string.
15UnsupportedOperationException
An unsupported operation was encountered.

Following is the list of Java Checked Exceptions Defined in java.lang.

Sr.No.
Exception & Description
1ClassNotFoundException
Class not found.
2CloneNotSupportedException
Attempt to clone an object that does not implement the Cloneable interface.
3IllegalAccessException
Access to a class is denied.
4InstantiationException
Attempt to create an object of an abstract class or interface.
5InterruptedException
One thread has been interrupted by another thread.
6NoSuchFieldException
A requested field does not exist.
7NoSuchMethodException
A requested method does not exist.
raja
Published on 20-Jul-2018 16:05:39
Advertisements