Java Reference
In-Depth Information
If the (possibly unboxed) value of the Expression is false the first time it is eval-
uated, then the Statement is not executed.
14.12.1. Abrupt Completion of while Statement
Abrupt completion of the contained Statement is handled in the following manner:
• If execution of the Statement completes abruptly because of a break with no label,
no further action is taken and the while statement completes normally.
• If execution of the Statement completes abruptly because of a continue with no la-
bel, then the entire while statement is executed again.
• If execution of the Statement completes abruptly because of a continue with label L ,
then there is a choice:
♦ If the while statement has label L , then the entire while statement is executed
again.
♦ If the while statement does not have label L , the while statement completes ab-
ruptly because of a continue with label L .
• If execution of the Statement completes abruptly for any other reason, the while
statement completes abruptly for the same reason.
The case of abrupt completion because of a break with a label is handled by the general
rule for labeled statements (§ 14.7 ) .
14.13. The do Statement
The do statement executes a Statement and an Expression repeatedly until the value of the
Expression is false .
DoStatement:
do Statement while ( Expression ) ;
The Expression must have type boolean or Boolean , or a compile-time error occurs.
A do statement is executed by first executing the Statement . Then there is a choice:
• If execution of the Statement completes normally, then the Expression is evaluated.
If the result is of type Boolean , it is subject to unboxing conversion (§ 5.1.8 ) .
If evaluation of the Expression or the subsequent unboxing conversion (if any)
completes abruptly for some reason, the do statement completes abruptly for the
same reason.
Search WWH ::




Custom Search