Sponsered Links
Categories
Sponsered Links

Do While Loop in java

 

 This example illustrates how to create the do-while loop in java.

In some conditions, you need to run some statements and processes once at least. For that you have to use the do while loop. It is same as the while loop statement but while loop first checks the certain condition and if condition is true then statements or processes are executed otherwise all the statements written under the while loop is ignored by the interpreter but do - while loop executes all the statements first at once and then check the condition if the condition is true then all the statements are also executed in second time otherwise second time ignored all the statements.

 Source Code of dowhileloop.java

class dowhileloop{
  public static void main(String[] args){
       int a= 80;
       int i=Integer.parseInt(args[0]);
     do{
       System.out.println("the value of: "+a);
       i++;
     }while(i<9);
  }
}

 
 
Sponsered Links
Latest Updates
 
All Content of this site is for learning only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright © 2009 JSPSERVLETTUTORIAL.INFO All Right Reserved