How is Garbage collection done in Java?

Answer Posted / sandeep

Garbage Collection is a complex feature in Java Technology.
By Programme we cannot cause gc but we can request JVM using
gc() method but it does not gurantee. Actually when an
object in our programme become unreachable it is ready to
garbage collection..the garbage collection runs periodically
and then claim the memory it does occupy ( the unreachable
object)..and is how garbage collected is done.

Is This Answer Correct ?    17 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can we find the sum of two linked lists using stack in java?

580


Write code of any action class?

554


why doesn't java run on all platforms?

579


What are different types of encoding?

591


How to sort an array in java without using sort method?

532






Why string is immutable or final in java

638


What is linkedlist in java?

512


Difference between final and effectively final ? Why is effectively final even required ?

567


What is temp in java?

561


Difference between Linked list and Queue?

613


If an object reference is set to null, will the garbage collector immediately free the memory held by that object?

645


What are the different types of collections in java?

534


Explain the difference between an Interface and an Abstract class?

640


What do you mean Abstraction in java?

615


Explain throw keyword in java?

622