In java programming, Exception class is a subclass of class Throwable.
Error: In java programming, error is Unrecoverable. It occurs during compile time.
For example, if we write wrong syntax then error will generate during compile time.
There are two types of Exception
- Checked Exception
- Unchecked Exception
Here is the list of some checked exception
- IllegalAccessException: in java programming, this exception occurs when access to a class is denied.
- ClassNotFoundException: this exception occurs when class not found.
NoSuchMethodException :when a requested method dose notexist this exception occurs.
- CloneNotSupportedException: in java programming
,Ifyou are trying to use the clone method in a classwhereCloneable interface is not implemented, it throwsCloneNotSupportedException. Clone() method is used to create exactcopyof a object InterruptedException :in java, when we work with multiple threads then one thread interruptsanother thread.
- ArithmeticException : in java programming this exception, represent the arithmetic error, such as divided-by-zero.
- IndexOutOfBoundsException: when some type of index is out of bounds this exception occur.
- ArrayIndexOutOfBoundsException: in java programming this exception represent the Array index is out of bound. This condition is arises when we try to access illegal array index.
- StringIndexOutOfBoundsException : in java programming, when we access the index outside the bound of string than this exception occurs.
- NegativeArraySizeException: when array is created with negative size than this exception is arises.
- NullPointerException: in java programming this exception occurs when invalid use of null reference.
- IllegalThreadStateException: this exception occurs , when required operation not compatible with current thread state.