Throwable Class
Purpose:
- The
throwstatement is permitted to throw only instances of the classThrowableand its subclasses.
Mechanics:
The following list shows the hierarchical relationships and of all the exception classes predefined in packagejava.lang
by the Java language:
Throwable
Error
LinkageError
ClassCircularityError
ClassFormatError
ExceptionInInitializerError
IncompatibleClassChangeError
AbstractMethodError
IllegalAccessError
InstantiationError
NoSuchFieldError
NoSuchMethodError
NoClassDefFoundError
UnsatisfiedLinkError
VerifyError
VirtualMachineError
InternalError
OutOfMemoryError
StackOverflowError
UnknownError
ThreadDeath
Exception
ClassNotFoundException
CloneNotSupportedException
IllegalAccessException
InstantiationException
InterruptedException
RuntimeException
ArithmeticException
ArrayStoreException
ClassCastException
IllegalArgumentException
IllegalThreadStateException
NumberFormatException
Illegalmonitorstateexception
IndexOutOfBoundsException
NegativeArraySizeException
NullPointerException
SecurityException
The following are the methods in the Throwable class:
public class Throwable {
public Throwable();
public Throwable(String message);
public String toString();
public String getMessage();
public Throwable fillInStackTrace();
public void printStackTrace();
public void printStackTrace(java.io.PrintStream s);
}
Usage:
- Any operand of a
throwstatement must extend theThrowableclass or one of its subclasses.
email suggestions to: cs015tas@cs.brown.edu
