What this animation explains
Each invocation has a frame with locals and operand stack in the JVM model. Frames disappear when methods return. Actual JVM optimizations may differ.

MODULE 1 · TOPIC 11 · VISUAL PROGRAMMING LAB
Explore stack frames, object references, heap reachability and garbage collection.
Browser-based simulations: change the inputs, trace the Java statements and inspect results. No arbitrary Java execution, real database, threads or file changes occur here.
Trace a method call, return value and frame removal.
Inputs above update the example. Highlighted line indicates the current operation. Fragments marked “inside main” or requiring setup belong in the indicated Java project.
Each invocation has a frame with locals and operand stack in the JVM model. Frames disappear when methods return. Actual JVM optimizations may differ.
Change x and inspect which variables disappear.
Watch two references point to the same or distinct objects.
Inputs above update the example. Highlighted line indicates the current operation. Fragments marked “inside main” or requiring setup belong in the indicated Java project.
Assignment copies references, not objects. Two aliases observe changes to the same object. Java passes reference values by value.
Set alias then separate; compare a.value.
Remove references and inspect eligible objects.
Inputs above update the example. Highlighted line indicates the current operation. Fragments marked “inside main” or requiring setup belong in the indicated Java project.
GC reclaims unreachable objects when the JVM chooses. A null assignment alone does not guarantee collection; another reference may keep the object reachable.
Choose no and compare reachability, not collection timing.
Create two references to an object, set one to null, and explain why the object remains reachable. Draw the heap and stack at each stage.
Edit the scratchpad below. Copy your code into an actual Java project or IDE to compile and test it.
Heap stores objects in the conceptual JVM model; class metadata and native memory are separate. Java GC does not close file handles reliably; use resource management. Memory leaks can still occur via retained references.