1int i=0;
2while(i<10){
3 if(i%2==0){
4 i++;
5 continue;// If it's pair we return to the while
6 }
7 System.out.println(i);// If is not we print it.
8 i++;
9}
1// continue in java example
2import java.util.*;
3public class ContinueJavaExample
4{
5 public static void main(String[] args)
6 {
7 for(int a = 1; a <= 10; a++)
8 {
9 if(a % 2 != 0)
10 {
11 continue;
12 }
13 System.out.println(a + " ");
14 }
15 }
16}
1int i = 0;
2while (i < 10) {
3 if (i == 4) {
4 i++; //why do I need this line ?
5 continue;
6 }
7 System.out.println(i);
8 i++;
9}
1 int number = 4;
2 int finalnum = 20;
3 while(number <= finalnum){
4 number++;
5 if(number %2 != 0){//Each odd number restarts the loop
6 continue;
7 }
8 System.out.println("Even Number!: "+ number);
9 }
10 }//EOM