Java Reference
In-Depth Information
Here, the expression is evaluated
after
the statement is executed. While
the expression is
true
, the statement is executed repeatedly. The state-
ment in a
dowhile
loop is almost always a block.
Exercise 10.4
: Select a few previous exercise solutions for which you
have used a
for
loop and rewrite it using a
while
loop. Can you also re-
write it using a
dowhile
loop? Would you do so? If not, why not?