Java Reference
In-Depth Information
• A switch statement can complete normally iff at least one of the following is true:
♦ The switch block is empty or contains only switch labels.
♦ The last statement in the switch block can complete normally.
♦ There is at least one switch label after the last switch block statement group.
♦ The switch block does not contain a default label.
♦ There is a reachable break statement that exits the switch statement.
• A switch block is reachable iff its switch statement is reachable.
• A statement in a switch block is reachable iff its switch statement is reachable and
at least one of the following is true:
♦ It bears a case or default label.
♦ There is a statement preceding it in the switch block and that preceding state-
ment can complete normally.
• A while statement can complete normally iff at least one of the following is true:
♦ The while statement is reachable and the condition expression is not a constant
expression (§ 15.28 ) with value true .
♦ There is a reachable break statement that exits the while statement.
The contained statement is reachable iff the while statement is reachable and the
condition expression is not a constant expression whose value is false .
• A do statement can complete normally iff at least one of the following is true:
♦ The contained statement can complete normally and the condition expression
is not a constant expression (§ 15.28 ) with value true .
♦ The do statement contains a reachable continue statement with no label, and the
do statement is the innermost while , do , or for statement that contains that contin-
ue statement, and the continue statement continues that do statement, and the
condition expression is not a constant expression with value true .
♦ The do statement contains a reachable continue statement with a label L , and the
do statement has label L , and the continue statement continues that do statement,
and the condition expression is not a constant expression with value true .
♦ There is a reachable break statement that exits the do statement.
The contained statement is reachable iff the do statement is reachable.
• A basic for statement can complete normally iff at least one of the following is true:
♦ The for statement is reachable, there is a condition expression, and the condi-
tion expression is not a constant expression (§ 15.28 ) with value true .
Search WWH ::




Custom Search