Do While loop

A do...while loop is similar to a while loop, except that a do...while loop is guaranteed to execute at least one time.


The syntax of a do...while loop is:

do {
} while(Boolean_expression);


Let's create a file with name "" :

public class Dowhile {

   public static void main(String args[]){

      int x = 1;

      do {

         System.out.print("value of x : " + x );

      } while( x < 20 );



If the Boolean expression is true, the control jumps back up to do statement, and the statements in the loop execute again. This process repeats until the Boolean expression is false.

Compile it and Run :

c:\java>java Dowhile

Loading ...

Related Results :

  1. Do While loop
Note :
  • Related Posts are generally User Blog posts.
  • or Other tutorials from other networks of
  • Any registered user can create related posts based on search term tags.

About the Author