Java Reference
In-Depth Information
This program produces the following output, which is the same as that produced by the
first version of the program shown earlier:
Since
genException( )
is called from within a
try
block, the exception that it generates
(and does not catch) is caught by the
catch
in
main( )
. Understand, however, that if
genEx-
ception( )
had caught the exception itself, it never would have been passed back to
main(
)
.
The Consequences of an Uncaught Exception