while (boolean expression) statement
or
do
statement
while (boolean expression);
The loop statement executes if the expression evaluates to true
. The difference between the alternatives is whether the test is done on entry to the loop or at the end. In the second case the statement in the loop must be executed at least once.
int j = 0;
while (j < 10)
{
System.out.println (j + " " + j * j);
j++;
}