... while
to output the numbers 1–10.
Line 6 declares and initializes control variable counter
. Upon entering the do…while
statement, line 9 outputs counter
’s value and line 10 increments counter
. Then the program evaluates the loop-continuation test at the bottom of the loop (line 11). If the condition is true
, the loop continues at the first body statement (line 9). If the condition is false
, the loop terminates ...
Get Java How to Program, Early Objects, 11th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.