Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Java by (6.5k points)
Wouldn't the 'continue' statement simply move along the program as it is supposed to?

1 Answer

0 votes
by (11.3k points)

The 'continue' statement skips the rest of the current iterative cycle of the loop and moves on to the next iterative cycle. In simple words, this means that whenever a 'continue' statement is encountered, any other lines of code in the immediate loop block will not be executed and the loop will move on to the next iteration. 

for (int i=1;i<=3;i++)


              if (i==2)




The above code will print:



This means that when the value of 'i' was '2', the loop moved on to the next iterative cycle.

If you're looking to learn java, understanding 'continue' and 'break' statements is imperative. 

Related questions

Browse Categories