posted 18 years ago
Object created at line 7 is eligible for gc.
Reasoning:
At line 6, one = 1
At line 7, titanic = 1.23
At line 8, str = sailing...
At line 9, a, one = 1
At line 10, b, titanic = 1.23
At line 11, c, str = sailing...
At line 12, c's value is given to b which in turn is given to a, so in effect a, b, c, str = sailing... and titanic = 1.23
At line 13, b, c, str = sailing...
At line 14, No one is pointing to 1.23 after making titanic = null
So in conclusion, the object created at line 7 is the only one which is eligible for gc.
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!