While Loop

While Loop is use to repeat a specific block of code until certain condition is met.

while (testExpression) {
// codes inside body of while loop
}

public static void main(String[] args) {

int i = 1;

while (i <= 10) {
System.out.println(“Line ” + i);
++i;
}
}