Page 1 of 1

About Question enthuware.ocajp.i.v7.2.884 :

Posted: Tue Oct 15, 2013 3:42 pm
by morris
This Question is not quite clear ...
By "What can be inserted at // 1,"and by the answer "obj.name = null; as well as obj = null;" I unterstand there can be inserted "obj.name = null" as well as there can be inserted "obj = null;"

Re: About Question enthuware.ocajp.i.v7.2.884 :

Posted: Tue Oct 15, 2013 5:51 pm
by admin
No, as the explanation says, obj.name = null; is not required to make obj eligible to be garbage collected.
You only need obj = null;
obj.name = null; will not make obj eligible to be garbage collected.

HTH,
Paul.

Re: About Question enthuware.ocajp.i.v7.2.884 :

Posted: Sat Sep 10, 2016 3:43 am
by ErikSKan
The question is to pick one answer that makes the object eligible for garbage collection. There are two such options that achieve this, even if the second includes some irrelevant code.

imo, it's poorly worded because the fifth answer is not incorrect.

Re: About Question enthuware.ocajp.i.v7.2.884 :

Posted: Sat Sep 10, 2016 9:24 pm
by admin
You may find such options in the real exam also. You need to pick the best answer.
HTH,
Paul.

Re: About Question enthuware.ocajp.i.v7.2.884 :

Posted: Mon Apr 22, 2024 3:29 pm
by diogo_loureiro933
I didn't quite understood this question, from what i recall an object is elegible for garbage collection once there are no more references pointing to it, or all of those references are out of scope. So, from my understanding both "obj.name = null; as well as obj = null;" make this condition true, therefore it looks the more righteous answer since it addresses both scenarios.

Re: About Question enthuware.ocajp.i.v7.2.884 :

Posted: Mon Apr 22, 2024 11:18 pm
by admin
Please response above.