example of a while loop in java
Example 1: while loop in java
// Java infinite while loop
import java.util.*;
public class WhileLoopExample
{
public static void main(String[] args)
{
boolean value = true;
while(value)
{
System.out.println("Infinite loop");
}
}
}
Example 2: what is a do while loop in java
do {
//something you want to execute at least once
} while (someBooleanCondition);
Example 3: java while
while (condition) {
// code block to be executed
}