This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Use Of Continue in do While Loop Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Use Of Continue in do While Loop" Watch "Use Of Continue in do While Loop" New topic
Author

Use Of Continue in do While Loop

Aniruddha Jadhao
Greenhorn

Joined: May 10, 2006
Posts: 24
Hi,
is there no use of continue in do While loop?

please look in following code

public class Continue {

public static void main(String [] a){
boolean flag =true;
int i=0;
do{
flag= false;
System.out.println(i++);
flag = i<10;

continue;//here with it/with out the same out put

}while(flag?true:false);
}
}
S Thiyanesh
Ranch Hand

Joined: Mar 19, 2006
Posts: 142
A continue statement will always check the condition in loops and proceeds the next iteration.
In your example, the continue statement will not bypass the loop condition.

try


Hope this one does the purpose of printing only the values of i >= 5 and i <= 10
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Use Of Continue in do While Loop
 
Similar Threads
Play again function help?
do while loop problem
Confusion again???
How can I really stop/kill a thread?
what's the continue functionality in do/while loop?