Java Reference
In-Depth Information
Table 9-1 Commonly Used Methods Defined by Throwable
Of the methods defined by Throwable , two of the most interesting are printStack-
Trace( ) and toString( ) . You can display the standard error message plus a record of the
method calls that lead up to the exception by calling printStackTrace( ) . You can use
toString( ) to retrieve the standard error message. The toString( ) method is also called
when an exception is used as an argument to println( ) . The following program demon-
strates these methods:
 
Search WWH ::




Custom Search