| All exceptions in Java are subclassed from the class Throwable. |
| |
| If we want to create your own exception classes, we must subclass Throwable.
Most Java programs do not have to subclass their own exception classes. |
| |
| Following is the public portion of the class definition of Throwable: |
| |
public class Throwable
{
public Throwable() ;
public Throwable(String message) ;
public String getMessage()
public String toString() ;
public void printStackTrace() ;
public void printStackTrace(
java.io.PrintStream s) ;
private native void printStackTrace0(
java.io.PrintStream s);
public native Throwable fillInStackTrace();
} |
| |
| Java exceptions are Throwable objects (they are instances of
Throwable or a subclass of Throwable). The Java packages
contain numerous classes that derive from Throwable and thus, build
a hierarchy of Throwable classes. |
| |
|
| |