Program to print odd and even numbers from an array

Source Code:

public class OddEvenNumbers {
public static void main(String[] args) {
int[] a = {1, 2, 3, 4, 5, 6};
System.out.print(“Even: “);
for(int i=0; i<a.length; i++) {
if(a[i] % 2 == 0) {
System.out.print(a[i] + " ");
}
}
System.out.print(" Odd: ");
for(int i=0; i<a.length; i++) {
if(a[i] % 2 != 0) {
System.out.print(a[i] + " ");
}
}
}
}

Output: