While Loop In Java | Java Tutorial

In the last tutorial, we learnt for loop and enhanced for loop and in this tutorial we will discuss while loop.

While Loop

The while statement continually executes a block of statements while a particular condition is true.

Syntax:

If the expression of while statement evaluates to true, then it executes the statement(s) in the while block. The while statement continues testing the expression and executing its block until the expression evaluates to false.

Sample Program:

Must Read: Java Tutorial

Get our latest blog posts delivered to your inbox

Subscribe and get popular blog posts about software testing industry.

Rajkumar

Leave a Comment

Share via
Copy link
Powered by Social Snap