My own thinking on the Q, correct me if I am wrong, please...
12. X3 x2 = new X3(); //object new X3()-1 reference to x2
13. X3 x3 = new X3(); //object new X3()-2 reference to x3
14. X3 x5 = x3; //x5 refer to x3 refer to new X3()-2 from L13.
15. x3 = x2; //x3 refer to x2 refer to new X3()-1 from L12.
16. X3 x4 = x3; //x4 refer to x3 refer to new X3()-1 from L15.
17. x2 = null; //set x2 ref variable to null,
//new X3()-1 lost reference, eligible for GC
18. // insert code
A. x3 = null; //if x3 ref variable set to null, cause new X3()-1
//lost reference, from L15 (same effect as L17)
B. x4 = null; //if x4 ref variable set to null, cause new X3()-1
//lost reference, from L16 (same effect as L17)
C. x5 = null; //if x5 ref variable set to null, cause new X3()-2
//lost reference, (from L14)
D. x3 = x4; //x3 refer to x4 refer to new X3()-1 also (L16)
E. x5 = x4; //x5 refer to x4 cause x3 & thus new X3()-2 to lost
//reference (L14)
Sounds convoluted, no wonder I am confused...
Anyone can explain above more clearly or simply?
Thks!