Software Testing Material

A site for software testers. We provide free online tutorials on Manual Testing, Automation Testing - Selenium, QTP, LoadRunner, Testing Tools and many more.

  • Blog
  • Tutorials
    • Manual Testing
    • Java
    • Selenium
      • TestNG
      • Maven
      • Jenkins
    • Framework
    • Katalon
    • Agile
    • SQL
    • VBScript
    • API Testing
  • Tools
    • TestLodge
    • FrogLogic GUI Tool
    • CrossBrowserTesting
    • BrowserStack
    • TestCaseLab
    • Kobiton
    • PractiTest
    • Sikuli
    • Postman
  • Interview Q & A
    • Selenium
    • TestNG
    • Test Framework
    • Explain Framework
    • Manual Testing
    • Software QA
    • Agile
    • Testing As A Career
    • General Interview Questions
    • API Testing
    • SOAP
    • JIRA
    • Protractor
  • Free Resources
  • Guest Post
    • Guest Post Guidelines
  • Training

Do While Loop In Java

Last Updated on June 8, 2018 by Rajkumar

The do-while is similar to the while loop. In do-while loop, the condition is evaluated after the execution of statements with in the do block at least once.

Do While Loop

Syntax:

1
2
3
4
do
{
   //statement(s);
} while(condition);

Sample Program:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
package ClassThreeControlFlowStatements;
 
public class DoWhileLoop {
 
      public static void main(String[] args) {
            int i=10;
            do{
                 System.out.println(i);
                 i--;
            }
             while(i>1);
            }
 
}

Must Read: Java Tutorial

SUBSCRIBE TO GET FREE EBOOK AND REGULAR UPDATES ON SOFTWARE TESTING

Filed Under: Java

data-matched-content-rows-num="2" data-matched-content-columns-num="3"
Previous Article:
Polymorphism in Java
Next Article:
Print In Java | Java Tutorial

About the Author

Rajkumar SM is a founder of SoftwareTestingMaterial. He is a certified Software Test Engineer by profession and blogger & youtuber by choice. He has an extensive experience in the field of Software Testing. He writes here about Software Testing which includes both Manual and Automation Testing. He loves to be with his wife and cute little kid 'Freedom'.

Comments

  1. Karthik says

    June 1, 2018 at 10:39 am

    Hi Sir,

    I am very happy, because of your valuable online materials. I just need to indicate you that, the syntax and sample program for the while and do-while loops are interchanged. I hope you will see this comment and consider as an important to change. Please do as soon as possible. Then only the visitors cannot get confused while referring this.
    Thank you.

    • Rajkumar says

      June 8, 2018 at 12:01 pm

      Thanks Karthik.

ADVERTISEMENT

Froglogic-Squish-GUI-Tester
CrossBrowserTesting

TUTORIALS

  • Manual Testing Tutorial
  • Selenium Tutorial
  • TestNG Tutorial
  • VBScript Tutorial
  • Agile Methodology
  • SQL Tutorial for Testers
  • INTERVIEW QUESTIONS

  • Framework Interview Questions
  • Real Time Manual Testing
  • 100 Top Selenium Interview Questions
  • 30 Top TestNG Interview Questions
  • Agile Interview Questions
  • 80 SQL Interview Questions
  • TESTING TOOLS

  • Test Lodge
  • FrogLogic Squish
  • Cross Browser Testing
  • BrowserStack
  • Test Case Lab
  • Sikuli
  • © 2019 www.softwaretestingmaterial.com | About us | Privacy Policy | Contact us | Guest Post | Disclaimer | Terms of use | Sitemap