// array of arrays // some syntax concerning initializer lists and anonymous arrays // you can only use initializer lists as // + a single statement combining declaration and initialization // + as part of an anonymous array public class aoa3 { public static void main(String args[]) { // make some 1-D arrays int[] x={1,2}; int[] y={3,4}; int[] z={5,6}; // create a 2-D array int[][] A = {x,y}; // can you change $A$ with the following code? // A = {x,z}; // no: aoa3.java:11: Array constants can only be used in initializers. // A = {x,z}; // ^ // 1 error // however, you may use an anonymous array A = new int[][] {x,z}; } }