5.6.2. The try Block
The general form of a try block is
try { program-statements} catch (exception-declaration) { handler-statements} catch (exception-declaration) { handler-statements} // . . .
A try block begins with the keyword try followed by a block, which, as usual, is a sequence of statements enclosed in curly braces.
Following the try block is a list of one or more catch clauses. A catch consists of three parts: the keyword catch, the declaration of a (possibly unnamed) object within parentheses (referred to as an exception declaration), and a block. When a catch is selected to handle an exception, the associated block is executed. Once the catch finishes, execution continues with the statement immediately following the last ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access