Challenge 1: Making an Object Unreachable — Possible Solution ==================================================================== ReachabilityDemo.java: public class ReachabilityDemo { public static void main(String[] args) { Object obj = new Object(); // obj is a GC root (a local variable on the stack) // reachable: the object is pointed to by obj obj = null; // At this point, the original Object created by `new Object()` // has no live reference pointing to it anywhere -- `obj` itself // now points to null instead. Since nothing reachable from any // GC root (this stack frame's local variables, active static // fields, etc.) leads to that original object anymore, it is // unreachable, and therefore eligible for garbage collection // the next time the JVM decides to collect. There was no // explicit free() call -- reassigning the only reference was // enough to make the object collectible. } } WHY THIS WORKS AS AN ANSWER ------------------------------ This demonstrates the exact reachability transition the chapter describes -- reassigning an object's only reference to null -- and the comment correctly uses "reachability" and "GC root" to explain why that alone is sufficient to make the object eligible for collection, with no manual deallocation step required.