Do-While Loop in java

The do-while loop looks like this: 



this ; 

and this ; 

and this ; 

and this ; 

} while ( this condition is true ) ; 

There is a minor difference between the working of while and do- while loops. This difference is the place where the condition is tested. The while tests the condition before executing any of the statements within the while loop. As against this, the do-while tests the condition after having executed the statements within the loop. Figure 3.5 would clarify the execution of do-while loop still further. 

While Loop and Do-While Loop:-

while ( 7 < 4 ) {

System.out.println ( "Hello");



print will not be executed


System.out.println ( "Hello") ; 

} while ( 7 < 4 ) ;



You may also like

What is PHP?

PHP stands for PHP: Hypertext pre-processor, with that PHP standi...

What is ASP.NET?

ASP.NET, the next version of ASP, is a programming framework used...

What is Data Structure?

A data structure is a group of data elements grouped together und...

What is C#?

C# removes some of the complexities and pitfalls of languages suc...

What is Math?

Math is no Definition it has only Calculation.Closure Property of...

What is Oracle?

Based in Redwood, California, Oracle Corporation is the largest s...

Function in java

A function in Java language is a block of code that performs a sp...

Do-While Loop in java

The do-while loop looks like this:do{ this ; and this ; and this ...