This content has been marked as final. Show 3 replies
Yes, your observation is right. You should be getting the same result with and without the 'continue 'statement since there is only one 'if and else' condition in the while loop. So, when age = 16, 'if ' condition will be executed and will come out of the loop even without the 'continue '. Hence continue statement is redundant in this case.
Edited by: howler on Aug 3, 2012 7:10 PM
Hi java-Man ,
There is nothing wrong with your code except it seems you didn't understand the concept of labels well. Labels are use to denote the boundaries for blocks of code. Labels are usually used in case you have multiple nested loops and you want to start(continue) or break the particular loop nestead loops. Example
for(int i=0; i < intArray.length; i++)
for(int j=0; j < intArray.length ; j++)
if(intArray[i][j] == 3)
System.out.println("Element is : " + intArray[i][j]);
Hope this helps.
Happy Coding :)