Program:
public class Array
{
public static void main(String[] args)
{
int a[] = new int[] { 1, 2, 3, 4, 5, 6, 7 };
System.out.println("The Array Elements:");
for (int i = 0; i < a.length; i++)
{
System.out.println(a[i]);
}
}
}
Compile:
javac Array.java
java Array
Output:
The Array Elements:
1
2
3
4
5
6
7