Other contributors have said "How can you force garbage collection in java?" is the same question as "What is garbage collection in java?" If you believe that these are not asking the same thing and should be answered differently, click here

What is garbage collection in java?

Answer:

Garbage collection is the process of freeing up unused memory. All classes and methods use the JVMs memory but in most cases they do not get cleared after they get used. The JVM does periodic checks to look for such unused memory objects and deletes them to provide for more space for the active components. The Garbage collection process is automatic and the programmer cannot control as to how and when it works.

First answer by Anandvijayakumar. Last edit by Anandvijayakumar. Contributor trust: 782 [recommend contributor recommended]. Question popularity: 1 [recommend question].