1
JavaIntermediate#exceptions
Automatic memory management that reclaims heap memory occupied by unreachable objects. Generational GCs (Young, Old, Metaspace) use algorithms like G1, ZGC, Parallel. You can suggest collection with System.gc() but cannot force it.
Person p = new Person(); p = null; // object now unreachable, eligible for GC System.gc(); // hint to JVM, not guaranteed