Q:

How are Java Nested Arrays implemented in memory?

Consider a nested array in java. Does the top level of the array contain references to the inner arrays, or does the memory actually contain the inner arrays themselves?
If you need an illustration, assume I have access to a reverse method, which will reverse an array in place by doing multiple swaps. If I call reverse on the top-level of an M*N nested array, what will that method simply swap references around (an O(m) operation), or will it be swapping entire rows around (an O(m*n) operation)?

A:

In a word references.  Arrays themselves are likely to be contiguous blocks, but it's unlikely that the Objects the elements refer to are.
This article sums it up nicely http://java.dzone.com/articles/what-does-java-array-look

