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

Answer Posted / samji

When a Java object becomes unreachable to the program, then
it is subjected to garbage collection. The main use of
garbage collection is to identify and discard objects that
are no longer needed by a program so that their resources
can be reclaimed and reused.

Is This Answer Correct ?    4 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by global variable?

539


What does this () mean in java?

552


What is difference between string and stringbuffer?

499


Can we clone singleton class in java?

529


Describe the syntax of multiple inheritance? When do we use such an inheritance?

593






What is main difference between variable and constant?

540


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

537


What are the types of arrays in java?

563


Explain hashset and its features?

588


What are the 8 primitive data types in java?

555


Garbage collection in java?

609


What about main() method in java ?

572


Can we sort array in java?

536


If we allocate the memory using 'new' & de-allocated using 'free' then what will happen?

603


What are examples of modifiers?

520