File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

do while loop

 
M Srilatha
Ranch Hand
Posts: 137
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Could any one please explain me how the following code works?




I thought the code will not compile! But it compiles as well as runs
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why you thought that this code will not compile? it looks OK. no problem in the code.
 
M Srilatha
Ranch Hand
Posts: 137
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey thanks for the reply!

I got it now.
This is how it works!


Before i was thinking that line 4 is a do while loop where its actually do in line4 pairs up with while in line 06. I didnt think in that way.

Anyways now its clear!
 
Ankit Garg
Sheriff
Posts: 9495
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think there will be no output.

The code can be thought of as

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic