The Java language is the most widely used programming
language to rely on garbage collection. The name "garbage collection"
implies that objects that are no longer needed by the program are
"garbage" and can be thrown away or destroyed. The Java virtual
machine's heap stores all objects created by a running Java application. Objects
are created by the new
operator but never freed explicitly by the code.
Garbage collection is the process of automatically freeing objects that are no
longer referenced by the program. Such as object must be recycled so that the
space is available for succeeding new objects. The garbage collector determines
which objects are no longer referenced by the program and make available the
heap space occupied by such unreferenced objects. Garbage collection relieves
the programmer from the load of freeing allocated memory.
Read example at:
http:/www.roseindia.net/java/beginners/GarbageCollection.shtml
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Java Garbage Collection
Post your Comment