♦ Java While Loop
♣ About Java While Loop
While Loop in Java is executed until a particular condition holds the boolean value true.♣ Java While Loop Syntax
Below is the representation of While Loop Syntax.Basic Syntax
while(expression){ //code }
Syntax Explanation:
expression: a conditional statement which yields a boolean value code: the desired code for execution
♣ Example1: Java While Loop
In this example, the program is printing square of integers, up till 5 from 1. Example
Input:
Output: