Start here. This is the direct spoken answer to practice first.
Overview
Garbage collection follows references from roots; it does not understand whether an object is still useful to the business.
The collector starts from GC roots such as active thread stacks, static fields, and certain JVM or native references, then traces objects reachable from them. Objects that are no longer reachable can have their heap memory reclaimed. Modern collectors usually exploit the observation that many objects die young, although the exact regions and algorithms depend on the selected collector. Reachability is the rule; reference counting is not Java's general garbage-collection model.