| Author |
Multydimensional Arrays
|
Aruna Balasuriya
Ranch Hand
Joined: Nov 14, 2009
Posts: 44
|
|
class A{}
public class B {
public static void main(String[] args) {
A[] a1 = new A[1];
A[][] a2 = new A[2][1];
a2[0] = a1;
}
}
Here a2[0] is it points to a1 array or it contains the value that a1 has ???
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19232
|
|
|
Multidimensional arrays are nothing more than arrays of arrays, and an array is in the end still an object. Therefore, you merely have another reference to the same array object. So yes, it points to a1 and nothing is copied.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: Multydimensional Arrays
|
|
|