Section 5.3 for Repetition Statement
• The while
statement can be used to implement any counter-controlled loop.
• The for
statement (p. 155) specifies all the details of counter-controlled repetition in its header
• When the for
statement begins executing, its control variable is declared and initialized. If the loop-continuation condition is initially true, the body executes. After executing the loop’s body, the increment expression executes. Then the loop-continuation test is performed again to determine whether the program should continue with the next iteration of the loop.
• The general format of the for
statement is
for (initialization; loopContinuationCondition; increment) statement
where the initialization expression names the loop’s ...
Get Java™ How To Program (Early Objects), Tenth 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.