Java – While Loop1 min read

The while loop is one of the fundamental loop statement in Java. It is an entry-control loop that is it checks the condition at the beginning of the block. And repeats a statement or block until the condition is true. And the increment of the variable checked in condition checking is done inside the block as shown in the below example.

While Loop in Java

Syntax of while loop:

Example of while loop in Java:

Output of while Loop:


do-while loop.
for loop.