The while Statement
In this lesson, we will explore one of Java's three loop-control statements, the while statement.
We'll cover the following
Syntax
The while
statement controls the execution of a while loop and has the following form:
while (condition)
statement
Here, condition is a Boolean expression like those we encountered in the if
statement. The while
statement tests condition to see whether to continue the iteration. As long as condition is true, statement executes, as the following figure illustrates.
Get hands-on with 1400+ tech skills courses.