When one wants to complete the iteration of a loop prematurely then 'continue' statement is used.
While the 'break' statement is used to exit the entire loop whenever encountered.
World of tricky Core Java Q&A(Java SE),Java EE and Open source technologies like Struts,Hibernate,Spring,Velocity etc
Disclaimer
Interview Questions On Java,Java EE Copyright © 2012
1 comments:
If you have nested loops/if statements, how far out will 'continue' and 'break' operate? For example:
while(condition1){
while(condition2){
if(condition3){
continue;
}
else{
break;
}
}
}
Post a Comment