☞'continue' is a keyword.
☞It can only be used in the body of loop.
public class ContinueExample1 {
public static void main(String[] args) {
for(int i=1;i<=10;i++){
if(i==5){
continue;
}
System.out.println(i);
}
}
}
1 2 3 4 6 7 8 9 10
public class ContinueExample2 {
public static void main(String[] args) {
for(int i=1;i<=3;i++){
for(int j=1;j<=3;j++){
if(i==2 && j==2){
continue;
}
System.out.println(i+" "+j);
}
}
}
}
1 1 1 2 1 3 2 1 2 3 3 1 3 2 3 3