Throwable Class

Purpose:

The throw statement is permitted to throw only instances of the class Throwable and its subclasses.

Mechanics:

The following list shows the hierarchical relationships and of all the exception classes predefined in package java.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 throw statement must extend the Throwable class or one of its subclasses.
Back to the Table of Contents
email suggestions to: cs015tas@cs.brown.edu