Java provides three repetition statements (also called iteration statements or looping statements) that enable programs to perform statements repeatedly as long as a condition (called the loop-continuation condition) remains true. The repetition statements are the
for and enhanced
for statements. (Chapter 5 presents the
for statements and Chapter 7 presents the enhanced
for statement.) The
for statements perform the action (or group of actions) in their bodies zero or more times—if the loop-continuation condition is initially false, the action (or group of actions) will not execute. The
while statement performs the action (or group of actions) in its body one or more ...