do

The do keyword is used as part of a do/while loop. Unlike the other, more commonly used loop constructs, a do/while loop expression is evaluated only after the block of code within its body has been executed. Thus, you are ensured that the code within the loop body is executed at least once, even if the expression tested causes the loop to end.

Note   Don't forget that a semicolon is required after the condition in a do/while loop.

The following code shows a typical do/while loop construct:

int i = getValue( );

do
{
    System.out.println("Printing at least once");
    .
    .
    .
} while ( i <= 10 );