![]() |
![]() |
![]() |
![]() |
![]() |
|
Java's while statement consists of a Boolean expression, in
parentheses, followed by an embedded statement or block:
while (Boolean expression) embedded statement or block
The Boolean expression is evaluated; if it
evaluates to true, the embedded statement or block is evaluated as
well; otherwise, Java skips the embedded statement or block. In contrast
to an if statement, however, the
testevaluate
loop continues as long as the Boolean expression evaluates to true,
so the computation is said to iterate.