File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Doubt:control flow working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Doubt:control flow working" Watch "Doubt:control flow working" New topic
Author

Doubt:control flow working

mansi gupte
Ranch Hand

Joined: Dec 30, 2008
Posts: 72


can some please explain the working of this code?


thanks,
Piya
harilal ithikkat
Ranch Hand

Joined: Oct 06, 2008
Posts: 221
Actually the output what iam geting is
Green

and my explanation is dat


while your i becomes 3 continue from start...but at that time i will remain 3 won't reinitialize and it becomes
4 because of i++
then count becomes 3 and break start means control will leave out of the iterator..i mean control will go to the code just after that for loop..

now it will print the colours[3] and its green





SCJP 1.5
"A candle looses nothing by lighting another candle"
itechmentors.com
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36453
    
  15
I hope you are not trying to tell us that labelled continue is good programming practice.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt:control flow working
 
Similar Threads
dan's control flow questions
continue statement example
Passing information to a class that displays a GUI.
Doubt about Switch statement (Compile Time Constant)