This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
There's no such thing as 'the length' of a multi dimensional array. Have a look at a one dimensional array:
This array is capable of holding (storing) 42 Objects. But have a look at the following:
This array is capable of holding (storing) 42 arrays of objects. Suppose I do the following: ; The first 'row' of my multi dimensional array myArray2 contains 4 elements, while the second 'row' of my multi dimensional array myArray2 just contains 2 elements. Multi dimensional arrays simply don'y exist; arrays of arrays *do* exist though and they're more than convenient. The example above showed a 'ragged' array, i.e. not every 'sub'array contained the same number of elements. The following declaration statement however defines a simple three dimensional matrix though:
Again, this is a 'ragged' array, but all three 'ragged' rows happen to contain the same number of elements, i.e. they all contain three elements and they all happen to be of type 'double'. The number of rows of such an array (matrix) can be retrieved by the simple expression 'myArray.length', while the number of columns (which happen to be all the same in this particular case) can be retrieved by the simple expression 'myArray3.length'. kind regards