×

Html & Html5

The World's best Software Development Study Portal

while Loop

While loop also iterate program number of times but iteration is not fixed.It test condition before execution of loop body.

Syntax:

while(condition){

//code to be executed

}



Example:


Class Abc{

public static void main(String args[]){

int i=0;

//while code

while(i<=10){

System.out.println(i);

i++;}

}

}

Output