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

Can we make main() thread as daemon?

566


What restrictions are placed on method overloading?

597


What are exceptions

634


Explain how hashmap works?

586


What is field name?

578






Explain the difference between protected and default access.

511


What is finally and finalize in java?

585


What is bigger kb or mb?

575


What is java ceil?

560


How objects of a class are created if no constructor is defined in the class?

573


What is a boolean flag in java?

559


How do you achieve singleton?

522


What is protected access modifier?

565


Do you need to import math in java?

556


Does java vector allow null?

529