Guide to Object-oriented Programming With Java (Buffalo State College Version)
Chapter 9: Using Loops
Java provides a few different control structures that allow you to loop through data using a set of statements.
for statement provides a way to loop through a statement, or group of statements, a number of times.
for Loop With an Array
for loop statement also provides a way to "walk" through an array.
while loop statement provides a way to to perform a statement or statements based on a condition being true or false.
do / while Loop
do ... while loop statements provide a way to to perform a statement or statements based on a condition being true or false. A
do ... while loop tests the condition at the end of the loop. S, a
do ... while loop will always execute at least once.
Let's get started with a While program!