// array of arrays public class aoa0 { public static void main(String args[]) { // create an array of arrays // each element of A will be an array int[][] A = new int[2][2]; // create array a0 and store values int[] a0 = new int[2]; a0[0] = 11; a0[1] = 12; // create array a1 and store values int[] a1 = new int[2]; a1[0] = 21; a1[1] = 22; // store arrays a0 and a1 as 1st and 2nd // elements of array A // Array A now stores 1D arrays as each element: A[0] = a0; A[1] = a1; // How do you access such a beast? // Use A[i][j] // The "i" refers to the elements of A // The "j" refers to elements of the elements of A System.out.println(); for (int i = 0; i <= 1; i++) { for (int j = 0; j <= 1; j++) System.out.print(A[i][j] + " "); System.out.println(); } } // method main } // class array_of_arrays /* Output 11 12 21 22 */