All of Java's exceptions descend from the class Exception. This table lists the ones you will see and use most often.

Exception Reason Example
ArithmeticException Illegal integer math operation.
Note that floating-point values don't throw exceptions
Dividing by 0
ArrayIndexOutOfBoundsException An element is accessed beyond the bounds of an array.  
ClassCastException When an object is cast to a type that is not in its branch of the class tree. An Integer object is cast to a String.
IllegalMonitorStateException A wait or notify call is not within synchronised code Any code that calls the wait or notify methods must be synchronized.
InterruptedException A thread interrupts a thread unexpectedly.  
IOException Illegal I/O operation. Reading past the end of a file.
NullPointerException Using a null pointer illegally Setting up back-to-back method calls and the first method returns a null value rather than an object, as in firstMethod().secondMethod().
OutOfMemoryException Working memory is full.  
NumberFormatException Parsing a string to a number where the string does not have the format of the number. Integer.parseInt("1.0") should be Integer.parseInt("1")

To add an entry or request an existing one to be altered, please fill in the comments form

Return to Top

About Java

Main Index

(c) Compiled by B V Wood.

 Main Index