While Loop In Java

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.


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

Rajkumar SM is a founder of SoftwareTestingMaterial. He is a certified Software Test Engineer by profession and blogger & youtuber by choice. He has an extensive experience in the field of Software Testing. He writes here about Software Testing which includes both Manual and Automation Testing. He loves to be with his wife and cute little kid 'Freedom'.

Leave a Comment

Share via
Copy link
Powered by Social Snap