The while loop provides Java users with the ability to execute any number of statements, as long as a predefined condition remains true. A count variable is not needed, so the termination condition can be set separately.
The termination condition operates on a boolean pattern. It means the while loop in Java executes the inserted statements as long as the condition specified in the header is true. If the termination condition becomes « false » for the first time, the loop terminates. Since the termination condition is already defined in the head of the while loop in Java, the while loop is said to be “head-controlled”.