posted 13 years ago
The advantage of using an array of arrays over a multi-dimensional array is that you don't have to have all the arrays the same size. You will find this sort of thing called a rectangular array:That creates a 3-element array, with references to int[] objects. Each int[] object contains 3 ints; since you haven't given them values they will all be 0s. Had you used reference types are the type of element, there would be 9 nulls. Beware of nulls.
You can also write this sort of thingThis is called a jagged array. Note numbers[1] is an empty array, but you can change that: