Javatpoint Logo
Javatpoint Logo

Java While Loop

The Java while loop is used to iterate a part of the program several times. If the number of iteration is not fixed, it is recommended to use while loop.

Syntax:

flowchart of java while loop

Example:

Output:

1
2
3
4
5
6
7
8
9
10

Java Infinitive While Loop

If you pass true in the while loop, it will be infinitive while loop.

Syntax:

Example:

Output:

infinitive while loop
infinitive while loop
infinitive while loop
infinitive while loop
infinitive while loop
ctrl+c

Now, you need to press ctrl+c to exit from the program.

Next TopicJava do-while Loop




Please Share

facebook twitter google plus pinterest tumbler

Latest 4 Tutorials