Java While Loop
Loops through a block of code while a specified condition is true.
Examples
Basic While Loop
Counts from 0 to 4.
public class Main {
public static void main(String[] args) {
int i = 0;
while (i < 5) {
System.out.println(i);
i++;
}
}
}Test Your Knowledge
Java Quiz
No quiz available for this topic yet.