This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
gc1 --> null
gc2 --> some object on heap
gc3 --> some object on heap
gc4 --> gc3
gc1 --> reference to object returned by doStuff --> create localGC (--> refer some object on heap) ---> passing same reference to doStuff2 (it does nothing with it) --> return the reference of localGC.
so overall -
gc1 --> refere to same object which localGC was assigned in dostuff method.