About Question com.enthuware.ets.scjp.v6.2.297 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
ETS User

About Question com.enthuware.ets.scjp.v6.2.297 :

Post by ETS User »

This last option:
Objects are deleted when they can no longer be accessed through any reference.
seems like very close to the correct answer, particularly because in all of the questions on Garbage Collection here it says that if ALL the references to the object (as well as references to references) are nulled, its eligible. So what is making this option not correct - that fact that even if if all the totoal references are nulled it still can be hanging in the memory and actually deleted after unknown period of time?

Guest

Re: About Question com.enthuware.ets.scjp.v6.2.297 :

Post by Guest »

Here is a quote from another question, com.enthuware.ets.scjp.v6.2.698 :
At the most, you can remove all the references to this object and wait for GC thread to destroy it but you cannot directly destroy any object.

Guest

Re: About Question com.enthuware.ets.scjp.v6.2.297 :

Post by Guest »

Guest wrote:Here is a quote from another question, com.enthuware.ets.scjp.v6.2.698 :
At the most, you can remove all the references to this object and wait for GC thread to destroy it but you cannot directly destroy any object.
and again, from the same question:
You can do so by making sure that the object is not referenced any where. For example, by setting all its references to null.

admin
Site Admin
Posts: 10384
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question com.enthuware.ets.scjp.v6.2.297 :

Post by admin »

ETS User wrote:This last option:
Objects are deleted when they can no longer be accessed through any reference.
seems like very close to the correct answer, particularly because in all of the questions on Garbage Collection here it says that if ALL the references to the object (as well as references to references) are nulled, its eligible. So what is making this option not correct - that fact that even if if all the totoal references are nulled it still can be hanging in the memory and actually deleted after unknown period of time?
By setting the all references to an object to null, that object is made eligible to be deleted. That doesn't mean it is actually deleted. It is possible that it is never deleted.

HTH,
Paul.

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests