Java: while loop
The Java while loop is a control flow statement, used to iterate a part of the program several times. It preferred when the number of iteration is not fixed.
See Also: Java: Types of Looping Statements
Syntax:
while(condition){ //code to be executed }
Flow chart for while loop
Example: Print even numbers between 1 to 20.
This is the same example written in for loopalso in the previous post.
View On WordPress














