1 public class ArrayDemo { 2 public static void main(String[] args) { 3 int[] anArray; // declare an array of integers 4 5 anArray = new int[10]; // create an array of integers 6 7 // assign a value to each array element and print 8 for (int i = 0; i < anArray.length; i++) { 9 anArray[i] = i; 10 System.out.print(anArray[i] + " "); 11 } 12 System.out.println(); 13 } 14 }