About Question enthuware.ocajp.i.v8.2.883 :
Posted: Tue Sep 22, 2015 6:19 am
Hello,
I have modified the question and was wondering if 'obj' is eligible for GC right after line 4? objArray[1] still points to obj, so I'm not sure. obj is now null, but still has a reference pointing to it and is therefore not eligible for GC. Am I correct?
Object obj = new String("a");
Object objArray [] = new Object[2];
objArray[1] = obj;
obj = null; //line 4
I have modified the question and was wondering if 'obj' is eligible for GC right after line 4? objArray[1] still points to obj, so I'm not sure. obj is now null, but still has a reference pointing to it and is therefore not eligible for GC. Am I correct?
Object obj = new String("a");
Object objArray [] = new Object[2];
objArray[1] = obj;
obj = null; //line 4