I'm just confused, I found this question from the Java Rule Round-Up Exam.
(#8) When you pass a reference to an array as an argument to a method call, you pass a NEW reference to the original array.
I answered false, because I think that it's not a NEW reference being passed but only a COPY of the reference. But it says its TRUE. But when I look at the explanation, it says "An array is an object, and Java always passes a COPY of the reference to the original object. Both references now point to the same array object." And I agree with the explanation, however, why is it TRUE?
I'm just really confused. Can anybody point out what I am missing out here?
"If you fail to plan, you plan to fail."<br /> <br />Chad<br />SCJP 1.4<br />SCWCD 1.4<br />SCBCD 1.3<br />SCDJWS (next)
Joined: Aug 10, 2005
A copy of the reference is indeed a NEW reference, the object that it refers to is the same as the original one, but the reference itself is indeed new. The point of that question is "Copy of the reference is passed", not the reference itself, that's what it means by "New". Hope it helps.