While loop executes group of Java statements as long as the boolean condition evaluates to true.
While loop syntax
Block of statements is any valid Java code. Boolean condition is any valid Java expression that evaluates to boolean value. Braces are options if there is only one statement to be executed.
While loop evaluates the boolean expression, and if it is true, it executes the block of statements. It continuously executes the block of statements until the boolean condition evaluates to false value. After that loop is terminated and statement immediately after the loop body will be executed.