×

Html & Html5

The World's best Software Development Study Portal

do while Loop

It is same as of while loop only difference is that it test condition after execution of loop body.So,whether condition is true or false loop body is executed atleast once.

Syntax:

do{

//code to be executed }

while(condition);

Example

Class Abc{

public static void main(String args[]){

int i=3;

do{

System.out.println(i);

i++;

}while(i<=6);

}

}

Output: