Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Help Java D The do Keyword

Related Tutorials


 
 

Share on Google+Share on Google+

The do Keyword

Advertisement
Keywords are special symbols in the Java programming language, which are reserved for a Java program.

The do Keyword   

     

Keywords are special symbols in the Java programming language, which are reserved for a Java program.

The do is a Java keyword, that may not be used as identifiers i.e. you cannot declare a variable or class with this name in your Java program. This keyword is used in control statement to declare a loop. It provides a repetitive task as long as the condition specified with the while keyword is true; then it exits from the loop when the specified condition is founded as false.

The syntax of do loop is written as: 

do{

   statement;

 }
while (condition);

 

  The do loop iterates a block of statements. For example:

do {

  i++;

} while ( i < maxNum );

 

 The do loop block is always executed once whether the condition specified with the while keyword is true or false. 

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: October 4, 2006

Related Tutorials

Discuss: The do Keyword  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com