Java Garbage Collection Question and Answers

13. When is an object subject to garbage collection?
  An object is subject to garbage collection when it becomes unreachable to the program in which it is used.
 
Your Name Your Email-ID
Your Answer
14. What kind of thread is the Garbage collector thread?
  It is a daemon thread.
 
Your Name Your Email-ID
Your Answer
15. What is finalize() method?
  finalize() method is used just before an object is destroyed and can be called just prior to garbage collection.
 
Your Name Your Email-ID
Your Answer
16. Does Java have destructors?
 
  • Garbage collector does the job working in the back ground. Java does not have destructors; but it has finalizers that do a similar job.
The syntax is
public void finalize()
{
}
 
Your Name Your Email-ID
Your Answer
1234 Page 4 of 4