An automatic memory management mechanism.
// Without GC, need to manage memory manually (C/C++ style).
An object is garbage when:
public void test() {
Person p = new Person("Alice");
p = null;
// Now the Person object is garbage
// End of method, no reference pointing
}
Starting points GC trusts as alive: