Top 50+ Java Garbage Collections Interview Questions and Answers - 1
Question: 1
What are the disadvantages of reference counting in garbage collection?
An advantage of this schema is that it can run in small chunks of time closely interwoven with the execution of the program.
This characteristic makes it particularly suitable for real time environments where the program can’t be interrupted for very long.
A disadvantage of reference counting is that it does not detect cycles.
A cycle is two or more objects that refer to one another.
Another disadvantage is the overhead of incrementing and decrementing the reference count each time.
Because of these disadvantages, references counting currently is out of favor.
Question: 2
What class of exceptions are generated by the Java run time system?
The Java runtime system generates Run time exception and Error exceptions.
Question: 3
What is garbage collection?
If no reference to an object, that object is assumed to be no longer needed, and the memory occupied by the object can be reclaimed.
This is known as garbage collection.
Question: 4
What is gc()?
gc() is a daemon thread.gc() method is defined in System class that is used to send request to JVM to perform garbage collection.
Question: 5
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()
{
}
If an object has a finalizer, the method is invoked before the system garbage collects the object.
Important Days in 2026-2027 National and International More
Important Days in January to December 2026-2027 More
Most Important GK Questions for Competitive Exams 2026-2027 Pdf More
PNC Bank Assessment Test 2026-2027 Answers More
Plus Two Biology Previous Year Questions and Answers Pdf More
Volume & Surface Area Questions for SSC, Bank PO, SO, Clerk Exams More
1000+ General English Test with Answers More
TNPSC Peoples Revolt MCQ Questions More
1000+ Digital Logic Families MCQs More
Top 100+ Indian History Quiz Questions and Answers More