What is garbage collection in Java?
Garbage collection is a process where Java removes objects based on their reference count, eliminating objects with zero references.
Iâ€™m a bit disappointed with this answer. Javaâ€™s garbage collection doesnâ€™t work with reference counting. It relies on the reachability of objects.
Can you explain how Java determines whether an object is reachable or not?