Not all of us carry our K&B books around all day. ;) So give us the full question please. Then, tell us what YOU think will happen if the code is changed as you suggest.
When line 8 is reached, which are true? (Choose all that apply.)
A. a1.acctNum == a3.password
B. a1.password == a2.password
C. Three objects are eligible for garbage collection.
D. Four objects are eligible for garbage collection.
E. Six objects are eligible for garbage collection.
F. Less than three objects are eligible for garbage collection.
G. More than six objects are eligible for garbage collection.
Correct Ans : D
Now follow :
As if change is made in Banker class
As with my understanding None of the object is eligible for GC since ob still hold the reference to the object(s).
Looks like all of us didn't Google this questions. This question has been discussed a lot in this forum. Click Here
I have another concern on answer B. The book says: B is correct, although when line 8 is reached, the references are lost.
Both references have gone, how can we compare them?
He's dead Jim. Grab his tricorder. I'll get his wallet and this tiny ad:
a bit of art, as a gift, the permaculture playing cards