Packages This Package Prev Next Index
public class java.lang.Throwable extends java.lang.Object (I-§1.12) { // Constructors public Throwable(); §1.21.1 public Throwable(String message); §1.21.2 // Methods public Throwable fillInStackTrace(); §1.21.3 public String getMessage(); §1.21.4 public void printStackTrace(); §1.21.5 public void printStackTrace(PrintStream s); §1.21.6 public String toString(); §1.21.7 }The Throwable class is the superclass of all errors and exceptions in the Java language. Only objects that are instances of this class (or of one of its subclasses) are thrown by the Java Virtual Machine or can be thrown by the Java throw statement. Similarly, only this class or one of its subclasses can be the argument type in a catch clause.
Here is one example of catching an exception:
try {
int a[] = new int[2];
a[4];
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println("exception: " + e.getMessage());
e.printStackTrace();
}
public Throwable()
public Throwable(String message)
message
-
the detail message
public Throwable fillInStackTrace()
try {
a = b / c;
} catch(ArithmeticThrowable e) {
a = Number.MAX_VALUE;
throw e.fillInStackTrace();
}
public String getMessage()
public void printStackTrace()
public void printStackTrace(PrintStream s)
public String toString()
Packages This Package Prev Next IndexJava API Document (HTML generated by dkramer on April 22, 1996)