Java arrays, Wat!?
There is a few things you can do with arrays which are surprising. Is it an array or not? Serializable array = new Serializable[9]; Is array an array or a scalar? Well its a scalar which points to an array. Just like Object o = new Object[9]; You can assign an array to an object because it is also an object. However, arrays are also Serializable so you can assign them to Serializable. Where did my [] go? The [] can appear in surprising places. This compiles for backward comparability reasons. public static int method(int[]... args)[] { return args[0]; } And the types here are; args is an int[][] and the return type is int[]. Did you notice the [] after the method declaration! This is not part of the JLS and the OpenJDK allows this due to backward compatibility reasons. What is the difference between int[] array and int array[] ? There is a difference in what comes after it. int[] array, x[]; and int array[], y[]; In these cases