
Arrange catch blocks to
handle the more special-
ized exceptions first,fol-
lowed by more general
exceptions.
SOFTWARE
ENGINEERING TIP
11.1 Simple Exception Handling 747
exception occurred, and also notice that our prompt clearly explains the
problem to the user.
11.1.2 Catching Multiple Exceptions
If the code in the try block might generate multiple types of exceptions, we
can provide multiple catch blocks, one for each possible exception. When
an exception is generated, the JVM searches the catch blocks in order. The
first catch block with a parameter that matches the exception thrown will
execute; any remaining catch blocks will be skipped.
Remember that ...