411 REFERENCE · Wikibooks
Java Programming/Keywords/catch
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
is a keyword.
It's part of a block. If an exception is thrown inside a try block, the exception will be compared to any of the catch part of the block. If the exception match with one of the exception in the catch part, the exception will be handled there.
For example:
try {
//...
throw new MyException_1();
//...
} catch ( MyException_1 e ) {
// --- Handle the Exception_1 here --
} catch ( MyException_2 e ) {
// --- Handle the Exception_2 here --
}
See also:
Java Programming/Keywords/try
deep