All Courses
do while loop in java language

do while loop Java

May 2nd, 2019 Java

Java do while loop

Syntax:

do
{
……;
} while(condition);

Description:

Exit level loop, executes the statements at least once even if condition is false process continues until the condition is failed.

Example:

int i=0;
do
{
i++;
System.out.println(“Print 5 times”);
} while(i<5);

Output:

Print 5 times

Print 5 times

Print 5 times

Print 5 times

Print 5 times

Social Share:

0 responses on "do while loop Java"

Leave a Message

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