|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--java.lang.Throwable
An object signalling that an exceptional condition has occurred. All exceptions are a subclass of Exception. An exception contains a snapshot of the execution stack, this snapshot is used to print a stack backtrace. An exception also contains a message string. Here is an example of how to catch an exception:
try {
int a[] = new int[2];
a[4];
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println("an exception occurred: " + e.getMessage());
e.printStackTrace();
}
| Constructor Summary | |
Throwable()
Constructs a new Throwable with no detail message. |
|
Throwable(String message)
Constructs a new Throwable with the specified detail message. |
|
| Method Summary | |
Throwable |
fillInStackTrace()
Fills in the excecution stack trace. |
String |
getMessage()
Gets the detail message of the Throwable. |
void |
printStackTrace()
Prints the Throwable and the Throwable's stack trace. |
void |
printStackTrace(PrintStream s)
|
String |
toString()
Returns a short description of the Throwable. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Throwable()
public Throwable(String message)
message - the detailed message| Method Detail |
public String getMessage()
public String toString()
toString in class Objectpublic void printStackTrace()
public void printStackTrace(PrintStream s)
public Throwable fillInStackTrace()
try {
a = b / c;
} catch(ArithmeticThrowable e) {
a = Number.MAX_VALUE;
throw e.fillInStackTrace();
}
printStackTrace()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||