SCJP1.5(86%)<br />SCWCD1.4(95%)<br />SCBCD1.3(92%)<br />IBM 252
all events occur in real time
SCJP1.5(86%)<br />SCWCD1.4(95%)<br />SCBCD1.3(92%)<br />IBM 252
Originally posted by Burkhard Hassel:
Hi Prashanth,
you wrote:
My guess is all 3 objects as after local method,all references are set to null??
That's what I though also, but it is not what the creators of these tests want to hear. At that very point, the method is not yet over (after a millisecond, it will be). But they're wanting us to really see where the references point to. And count the objects that are dereferenced at that point.
I guess, that example is from you?
Here is my solution, I hope it is correct:
I'm not ready with the counting yet, maybe tomorrow.
Yours,
Bu.
Intellect distinguishes between the possible and the impossible; Reason distinguishes between the sensible and the senseless. Even the possible can be senseless.......
Originally posted by Gaurang:
IMO since the compiler is still in the main method only 2 objects will be eligible for gc, the once with the reference = null, i.e r2 and r4
may be this will help
r2 = null
and since r4 = r2, even r4 = null,
but r5 will still refer to the rubbish object from line 7, and hence r1 will aslo refer to same object.
The Best way to predict your future is to create it - Every great individual common man
IMO since the compiler is still in the main method only 2 objects will be eligible for gc, the once with the reference = null, i.e r2 and r4
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
SCJP1.5(86%)<br />SCWCD1.4(95%)<br />SCBCD1.3(92%)<br />IBM 252
Originally posted by Saurabh Vyas:
At line 12 only 2 objects r2 & r4 are eligible for garbage collection.
SCJP1.5(86%)<br />SCWCD1.4(95%)<br />SCBCD1.3(92%)<br />IBM 252
(hope is correct...)
ehem...
all events occur in real time
These are the worst of times and these are the best of times. And this is the best tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
|