1
JavaAdvanced#gc#jvm
Strong references prevent GC entirely. Soft references are cleared only when memory is low (good for caches). Weak references are cleared at the next GC cycle regardless of memory pressure (good for canonicalizing maps). Phantom references are used for cleanup actions after an object is finalized.
WeakReference<Object> weakRef = new WeakReference<>(new Object()); // object can be GC'd even though weakRef exists, once no strong refs remain