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

Sharing is caring.

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

Like This Post?

We have a lot more where that came from?

We only send really good stuff occasionally, promise.

Rajkumar SM

Leave a Comment

Your email address will not be published. Required fields are marked *

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on whatsapp

Recent Posts:

Scroll to Top
API Testing eBook

DOWNLOAD FOR FREE