Program to print the elements of an array

Source Code:

public class PrintArray {
public static void main(String[] args) {
int[] a = {10, 20, 30, 40};
for(int i=0; i<a.length; i++) {
System.out.print(a[i] + " ");
}
}
}

Output: