A do-while loop runs the body first and checks the condition after. This guarantees the body executes at least once, even if the condition is false from the start.
int num = 10;
do {
System.out.println(num);
num++;
} while (num < 5);
This prints 10 and then stops. Even though 10 < 5 is false, the body ran once before the check happened. With a regular while loop, nothing would print at all.
The do-while loop is the right choice when you need at least one execution. A common example is menu input: you want to show the menu at least once, then keep showing it while the user hasn't picked "exit." Without do-while, you'd have to duplicate the menu display code before the loop.