This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Can somebody explain How the answer to this question becomes" 15 15" ?
you are passing copy of the reference of a1 to a method called fix, there you are modifying the object array[which referenced by a1] by using the copy of reference a3 then assign to the object array to reference a2. so now a2 and a1 both reference to the existing array object. hence the result.
The fix() method changes the value of the second element of the array to 7 so you now have Then the println statements displays the total sum of the values of the elements, which is equal to 15 15. If you want individual elements to be displayed then modify the println statement as follows:
I hope this helps
In Your Pursuit Towards Certification, NEVER Give Up.