Font Awesome Icons

Tutorial

Looping statement in Java:

Looping statements are the statements which executes a block of code repeatedly until some condition meet to the criteria. Loops can be considered as repeating “if” statements. There are 3 types of loops available in Java:

1)while:

while loops are simplest kind of loop. It checks and evaluates the condition and if it is true then executes the body of loop. This is repeated until the condition becomes false. Condition in while loop must be given as a Boolean expression.

while syntax:

while (condition)
{
statement1;
}

class while1
{
public static void main(String args[])
{
int j = 1;
while (j <= 10)
{
System.out.println(j);
j = j+2;
}
}
}