There is Different types of Loops in Java Programming

  • For Loop
  • Do While
  • While

For Loop

Syntax : 
for (Initialise ; Condition; Increment / Decrements) {
//Operation Statement
}

Example :
for (i=0; i<10; i++) {
System.out.println(i);
}

Its Display  0123456789

Program :

Output :

Basic_for_loop

Do While Loop

Syntax : 
Initialise;
Do{
//Operation Statement
//Increment / Decrements
}
while(Condition)

Example :
i=0;
do{
System.out.println(i);
i++;
}while( i<10);

Its Display  0123456789

Program:

Output :

Basic_do_while_loop

While Loop

Syntax : 
Initialise;
while( Condition){
//Operation Statement
//Increment / Decrements
}

Example :
i=0;
while( i<10){
System.out.println(i);
i++;
}
Its Display  0123456789

Program:

Output :

Basic_while_loop

(Visited 12 times, 1 visits today)

Written by: