The Java while loop is used to iterate a part of the program repeatedly until the specified Boolean condition is true. As soon as the Boolean condition becomes false, the loop automatically stops.
The while loop loops through a block of code as long as a specified condition is true
Syntax :
while (condition) {
// code block to be executed
}
Comments