The continue statement is used to go to the next iteration of a loop without running the remaining code for the current iteration. It advances to the following iteration rather than closing the loop.
/*** Java Continue Example*/public class JavaExample {public static void main(String[] args) {for(int i=0;i<=10;i++){if (i==5){System.out.println("Loop Continue Work Here : " +i);continue;}System.out.println("Loop index : " +i);}}}
Output:
Loop index : 0
Loop index : 1
Loop index : 2
Loop index : 3
Loop index : 4
Loop Continue Work Here : 5
Loop index : 6
Loop index : 7
Loop index : 8
Loop index : 9
Loop index : 10