Explain garbage collection.
Java uses garbage collection to free the memory. By cleaning those objects which is no longer reference by any of the program. Step involve in cleaning up garbage collection:
Garbage Object Collection: first step is to collect and group all those object which are no more reference with any of the program. We can use different methods to collect garbage object like using runtime.gc() or system.gc().
Run Finalize method: To free up those object that is collected by garbage collector java should execute the Finalize method to delete all those dynamically created object.