- The while loop in Java is a control flow statement that repeatedly executes a block of code as long as a given condition is true. It is an entry-controlled loop, meaning the condition is checked before the loop body is executed. SYNTAX
while (condition) {
    // Code to be executed repeatedly
     Incerment //decerment operater
}
condition: 
     * A boolean expression that determines whether the loop should continue.
Code block: 
     * The set of statements that will be executed repeatedly as long as the condition is true.
EXAMPLE PROGRAM:
public class WhileExample {
    public static void main(String[] args) {
        int count = 0;
        while (count < 5) {
            System.out.println("Count is: " + count);
            count++;
        }
    }
}
OUTPUT:
0
1
2
3
4
REFERRED LINKS :
 


 
    
Top comments (0)