Top 50+ Java Garbage Collections Interview Questions and Answers - 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.
What class of exceptions are generated by the Java run time system?
The Java runtime system generates Run time exception and Error exceptions.
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.
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.
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.
1000+ Civil Engineering Interview Questions and Answers Pdf More
1000+ Civil Engineering Questions for Interview More
1000+ Building Materials and Construction Multiple Choice Questions More
1000+ Building Materials and Construction Objective Questions Pdf More
100+ Civil Engineering Question Papers with Answers Pdf More
Top 100+ Direct and Indirect Speech Online Test Quiz Questions More
Galaxy Quiz Questions and Answers More
100+ Train Problems Questions and Answers Pdf More
PG TRB Commerce Exam Date 2020-2021, Age Limit, Jobs Notifications More
1000+ Logical Reasoning Questions and Answers for Bank Exams More