Java Programming | Finding Even Numbers from Array


This is a tutorial for finding even numbers from array. The program is given below that takes numbers from user and saves them in array and find even numbers and prints them. The program is extendable. Go enjoy the program. Lets begin………….

Program for finding even numbers from array.

//import Scanner as we require it.
import java.util.Scanner;

// the name of our class its public
public class ArrayEvenNumber {
	//void main
		public static void main (String[] args)
			//declare int
			int i,x,a[] = new int[10];

			//Declare input as scanner
			Scanner input = new Scanner(;

			//Take input for arrays
			 System.out.println("Enter Number :");
			 a[i] = input.nextInt();

			System.out.println("Even Numbers are :-");
			//print the even numbers


Enter Number :
Enter Number :
Enter Number :
Enter Number :
Enter Number :
Even Numbers are :-

How does it work

  1. You enter the number.
  2. The number is saved in respective array.
  3. The numbers from arrays are taken and tested if even or odd.
  4. The even number is printed.

Extending it

The program can be extended by doing the same program for finding odd number. Go extend it.


  1. Import the Scanner.
  2. Declare the class as public
  3. Add the void main function
  4. Declare input as Scanner.
  5. Add a for loop.
  6. Add system.out.println() function with the message to enter number.
  7. Take the inputs and save it in arrays.
  8. Add one more loop to find even numbers.
  9. Add system.out.println() function to print even.

At the end.

You learnt creating the Java program for Cube of numbers in arrays. So now enjoy the program.

Please comment on the post and share it.
And like it if you liked.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s