Advertisement

Google Ad Slot: content-top

Java Do While


do...while Loop:

The do...while loop executes the code block at least once, regardless of the condition. The condition is evaluated after the code block executes.


Syntax:

do {
    // Code to execute
} while (condition);
Example
int i=1;
do
{
System.out.println("Hi"+i);
i++;
}
while(i<=4);
Try it yourself