Array is a data structure which contains of similar data type. We store only fixed set of elements in a java array. Array is used to store a collection of data, but it is often more useful to think of an array as a collection of variable of the same type.

To declare an array in a Java program, we must declare a variable to reference the array and we most specify the type of array the variable can reference.
Syntax:
                 dataType[] arrayRefVar;
                      or
                 dataType arrayRefVar[];


Program
 

import java.util.Scanner; 
class EvenArray{
     public static void main(String args[]){
 Scanner in = new Scanner(System.in); 
 int x, y; 
 System.out.print("Enter First Number : "); 
 x = in.nextInt(); 
 System.out.print("Enter Second Number : "); 
 y = in.nextInt(); 

 for(int i=x; i<=y; i++){
      if(i%2==0){
     System.out.println(i); 
      }
 }
     }
}