While Loop
Loops through a block of code as long as a specified condition is true.while (condition) {
// code block
}
Example
int i = 0;
while (i < 5) {
System.out.println(i);
i++;
}
Note: Do not forget to increase the variable used in the condition, otherwise the loop will never end (infinite loop).