GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 65 of 921    Print  
What is the difference between a break statement and a continue statement
A break statement results in the termination of the statement to which it applies (switch,for, do, or while). A continue statement is used to end the current loop iteration andreturn control to the loop statement.


  
Total Answers and Comments: 3 Last Update: May 07, 2008   
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Mithun Challa
 
When you are dealing with loops in your code (like for , while , do-while not if or switch)
continue will go back and increase the loop counter and start executing. all the statements below the continue in that loop would be skipped.

In case of break we exit out of the loop and go ahead.

Above answer was rated as good by the following members:
cvrao
September 08, 2005 01:48:26   #1  
Richa        

RE: What is the difference between a break statement and a continue statement
break statement  
A statement that terminates the current loop iteration and causes execution to break out of a loop. 
 
continue statement  
A statement that terminates the current loop iteration and persists the loop with the next iteration.

 
Is this answer useful? Yes | No
January 06, 2008 13:22:40   #2  
Mithun Challa Member Since: January 2008   Contribution: 6    

RE: What is the difference between a break statement and a continue statement
When you are dealing with loops in your code (like for , while , do-while not if or switch)
continue will go back and increase the loop counter and start executing. all the statements below the continue in that loop would be skipped.

In case of break we exit out of the loop and go ahead.

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
May 07, 2008 02:06:00   #3  
Shambhu Kumar Member Since: May 2008   Contribution: 4    

RE: What is the difference between a break statement and a continue statement ?
The break keyword halts the execution of the current loop and forces control out of the loop.

The continue is similar to break, except that instead of halting the execution of the loop, it starts the next iteration.


 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape