The Java do-while loop is used to iterate a part of the program repeatedly, until the specified condition is true. If the number of iteration is not fixed and you must have to execute the loop at least once, it is recommended to use a do-while loop.
The do block is executed at least once, even if the condition is false.
Syntax:
do{
//code to be executed
//Iteration
}while (condition);
Comments