catch

The catch keyword is used to introduce an exception-handling block of code. The keyword is followed by an exception type, an argument name in parentheses, and a block of code to execute should the specified exception actually occur. A try statement and its corresponding block of code always precede a catch statement. When an exception is thrown within the corresponding try statement block, the catch statement's exception type is evaluated to determine whether it is capable of handling the exceptional condition. If the exception type can be handled, the argument is assigned to the specified type and the code within the catch block is executed.

For an example of how the catch keyword can be used, see the keyword try.