This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Originally posted by Steve Harmison: ...int i = new int;
Surely Java does not know how much space to set aside for the array, as we have left the rightmost arguments blank!
Actually, it does know how much space to set aside for "the array."
In Java, multi-dimensional arrays are just arrays of arrays. And the elements of the array are just references -- not the objects themselves. So in this example, "i" simply references a single-dimension array of length 10, where each element is a reference to another array. (At this point, these 10 references are all null because we haven't put anything in "i" yet, but a null reference takes the same space as an object reference.)
In other words, the "size" or length of a multi-dimensional array is simply the first dimension, because it's really no different than a single-dimension array. Additional dimensions specify separate objects (arrays) that are in the first array. [ September 01, 2007: Message edited by: marc weber ]
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
I just read in my study guide in the past few days that  is the same as an object as far as Java is concerned.
Whenever you see something like this, you have to allow for the fact that (like marc weber states) the first  = new  only allocates the first array reference, the remaining two  being just places to put information about an arrary once it is created.
I never gave it a great deal of thought, but what Jesus Angeles will be of use in thinking about what is going on.
"The differential equations that describe dynamic interactions of power generators are similar to that of the gravitational interplay among celestial bodies, which is chaotic in nature."
Originally posted by Nicholas Jordan: ...the remaining two  being just places to put information about an arrary once it is created...
The empty brackets are necessary because they provide information about the type -- both when declaring the variable and when creating the object. Remember that the type of references an array holds is also part of the array's type. For example, String is an array that holds references to Strings. But String is an array that holds references to arrays (that in turn hold references to Strings).