What is garbage collection in Java, and how can it be used ?

Answer Posted / sivadasan

Garbage collection is a thread, that runs to reclaim the
memory by destroying objects which object is cannot be
referenced anymore.

Deleting Dynamically created objects from the memory.

Finalize method used to achieve garbage collection.

By using Runtime.gc() or System.gc() the object will be
garbage collected.

Is This Answer Correct ?    30 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a condition in java?

535


What are the legal parameters?

505


when you will synchronize a piece of your code? : Java thread

527


how to split string in java?

647


What does a za z0 9 mean?

560






Is final static java?

545


How to create a custom exception?

567


What is a singleton class in Java?

503


Define how does a try statement determine which catch clause should be used to handle an exception?

581


What is canonical name in java?

616


What is stringbuffer in java?

541


Does every java program need a main?

535


How to do encapsulation in java?

568


Where is singleton pattern used?

520


Are the imports checked for validity at compile time? Will the code containing an import such as java.lang.abcd compile?

591