Java Reference
In-Depth Information
synchronized(t) {
synchronized(t) {
System.out.println("made it!");
}
}
}
}
This program produces the output:
made it!
Note that this program would deadlock if a single thread were not permitted to lock a
monitor more than once.
14.20. The try statement
A try statement executes a block. If a value is thrown and the try statement has one or more
catch clauses that can catch it, then control will be transferred to the first such catch clause.
If the try statement has a finally clause, then another block of code is executed, no matter
whether the try block completes normally or abruptly, and no matter whether a catch clause
is first given control.
TryStatement:
try Block Catches
try Block Catches opt Finally
TryWithResourcesStatement
Catches:
CatchClause
Catches CatchClause
CatchClause:
catch ( CatchFormalParameter ) Block
CatchFormalParameter:
VariableModifiers opt CatchType VariableDeclaratorId
CatchType:
ClassType
ClassType | CatchType
Finally:
finally Block
The Block immediately after the keyword try is called the try block of the try statement.
Search WWH ::




Custom Search