Java Reference
In-Depth Information
In this program, divide-by-zero errors are handled locally, by genException( ) , but an
array boundary error is rethrown. In this case, it is caught by main( ) .
A Closer Look at Throwable
Up to this point, we have been catching exceptions, but we haven't been doing anything
with the exception object itself. As the preceding examples all show, a catch clause speci-
fies an exception type and a parameter. The parameter receives the exception object. Since
all exceptions are subclasses of Throwable , all exceptions support the methods defined by
Throwable . Several commonly used ones are shown in Table 9-1 .
Search WWH ::




Custom Search