Java Programming - Garbage Collections - Discussion
Discussion Forum : Garbage Collections - Pointing out the correct statements (Q.No. 2)
2.
Which statement is true?
Answer: Option
Explanation:
All objects are placed in the garbage collectible heap.
Option A is incorrect because the garbage collector makes no guarantees.
Option B is incorrect because islands of isolated objects can exist.
Option C is incorrect because finalize() has no such mystical powers.
Discussion:
3 comments Page 1 of 1.
Alexander Monakhov said:
1 decade ago
void f()
{
Object o = new Runnable() { public void run() {} };
}
'o' is allocated on stack, or JIT used is just a crap.
{
Object o = new Runnable() { public void run() {} };
}
'o' is allocated on stack, or JIT used is just a crap.
Corrie said:
1 decade ago
All objects are actually not placed in the garbage collectible heap. Only ones that can be garbage collected.
Objects that are instantiated in an anonymous class might still be used, because they are still in scope. They are not just on a garbage heap because they are in an anonymous class.
B. is correct, because the "islands of isolated objects" actually exist because they are referenced in a circular way, and cannot therefore be garbage collected.
Objects that are instantiated in an anonymous class might still be used, because they are still in scope. They are not just on a garbage heap because they are in an anonymous class.
B. is correct, because the "islands of isolated objects" actually exist because they are referenced in a circular way, and cannot therefore be garbage collected.
Surya said:
1 decade ago
Garbage collector is all so collecting of unused memory/referenced memory.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers