Do while loop in java

In the previous post , we have seen while- loop. In this post, we will see Do while loop in java.

Do..while loop also executes same set of statements like for-loop and while-loop.

Syntax of Do..while loop:

Note: It is also called ‘Exit controlled loop’ because condition is checked at the end of the loop. It will enter the loop atleast once and execute the code. At the end it will check the condition status true/false. If false exits the loop,else continue executing until condition become false.
Output: Number : 1
Number : 2
Number : 3
Number : 4
Number : 5
Number : 6
Number : 7
Number : 8
Number : 9
Questions/Suggestions
Have any question or suggestion for us?Please feel free to post in Q&A Forum
Print Friendly, PDF & Email
while loop in java
for loop in java
Shekhar Sharma

Shekhar Sharma

Shekhar Sharma is founder of testingpool.com. He is an automation engineer having more than 8 years of experience who loves troubleshooting in automation and finding innovative ways to solve the problems. His other leisurely activities includes playing harmonica, paintings, sketching portrait, watching movies and travelling etc.

You may also like...

1 Response

  1. August 10, 2015

    […] previous posts, we have seen while loop and Do ..while loop. In this post, we will see working of for […]