Loops are so important, and are so common in programs,
that there are several Java language features
for implementing them.
You have already seen
This chapter looks at
A programming language needs to have
only one general looping method.
while statement can be used to implement any type of loop.
as we have seen,
for statement often is
convenient, and also can be used to implement any type of loop.
do loop is occasionally convenient and can be used to implement any of the three types of loops.
However, of the three looping statements, it is used the least.
Some programmers prefer not to use it at all.
do statement is not part
of the AP (Advanced Placement)
computer science test given to
high school students in the US.
It is not used in the chapters that
follow this one.
There are several looping statements in Java, although only one (any one of them) is logically necessary.