Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What are the levels of garbage collection in java?

user-image
Question added by chaitanya kumar
Date Posted: 2013/11/08
Ashok Yadav
by Ashok Yadav , trainee , S.O Infotech Pvt. Ltd.

 

Garbage Collection in Java is carried by a daemon thread called Garbage Collector. Before removing an object from memory Garbage collection thread invokes finalize () method of that object and gives an opportunity to perform any sort of cleanup required.  You as Java programmer can not force Garbage collection in Java; it will only trigger if JVM thinks it needs a garbage collection based on Java heap size.There are methods like System.gc () and Runtime.gc () which is used to send request of Garbage collection to JVM but it’s not guaranteed that garbage collection will happen.

if you like the answer then plz like it..... :)

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.