previous | start | next

do Statement

Executes loop body at least once:
do
statement
while (condition);

Example: Validate input

double value;
do
{
String input = JOptionPane.showInputDialog(
"Please enter a positive number");
value = Integer.parseInt(input);
}
while (input <= 0);


previous | start | next