This is a prob from Tata mC graw Hill
scjp &
scjd Java 2 self guide pg452
12. X3 x2 = new X3(); //obj1
13. X3 x3 = new X3(); //obj2
14. X3 x5 = x3;
15. x3 = x2;
16. X3 x4 = x3;
17. x2 = null;
18. // insert code
what two lines of code, inserted independently at line 18, will make an object eligible for
garbage collection? (Choose two.)
A. x3 = null;
B. x4 = null;
C. x5 = null;
D. x3 = x4;
E. x5 = x4;
//answer given in book--->>.E and C
I agree with answer C but whats the use of assigning x4 to x5 in E.as C is sufficient to remove the last ref to obj 2.inserting statement E in the code would add one more reference var to obj 1.
please help
---------------
Shashank