Java List Even Numbers

 

Program to List Even Numbers in Java.

/**
 * Program to List Even Numbers Java Example.
 * @author W3schools360
 */
public class ListEvenNumberExample {
	static void listEvenNumber(int limitNumber){
		//Print limit number.
		System.out.println("Even numbers between 1 and " + limitNumber + ":");
        
		//Find even numbers.
                for(int i=1; i <= limitNumber; i++){               
                   //Test even number condition.
                   if( i
                      System.out.println(i);
                   }
              }
	}	
	
	public static void main(String args[]){ 
		//method call 
                listEvenNumber(60); 
	}
}

Output:

Even numbers between 1 and 60: 
2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
42
44
46
48
50
52
54
56
58
60