This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I was wondering about the number of bytes needed for an array of arrays. Given int vals is S = 5*10*4bytes or is only the array of length 5 counted against the space requirements of a given method?
"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
Unless I am much mistaken, Java does not let you declare an array with fixed sizes. And it requires that you fix exactly one dimension when constructing an array. Java does not really have multi-dimensional arrays, but you can have arrays of arrays, which works similarly in some situations.
In addition, there is no way in Java to determine programmatically how many bytes are used by an array, or by anything else. That's considered low-level detail from which Java deliberately insulates the programmer.
For instance, while Java specifies the sizes of numbers that can be stored in an int as the range that fits in a 32-bit signed integer, it does NOT require that 32 bits are used to store an int. In 64-bit machines, an int might well be stored in 64 bits, for instance (but it still would be unable to hold bigger values).
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.