INTERACTIVE JAVA LABS Java Memory, Arrays & OOP
3 Interactive Labs · 12 Step-by-Step Scenarios
Visual JVM & Compiler Trace Suite

See What Java Actually Does in Memory & at Runtime

Step line-by-line through Call Stack frames, Heap object references, 2-D array traversal, and dynamic method dispatch. Built for live classroom demonstrations and self-paced student tracing.

Start with Lab 1: Stack & Heap ▶
⌨️ ← / → Step Controls 🤔 Built-In Checkpoint Questions 📱 Mobile Swipe Ready

Interactive Lab Modules

LAB 01 · JVM MEMORY 4 Scenarios

Stack vs. Heap & Object References

Visualize why primitives copy values while object variables copy memory addresses, how pass-by-value works in method calls, and what triggers a NullPointerException.

Included Trace Scenarios
  • ① Primitive vs. ReferenceAliasing
  • ② Aliasing & ReassignmentOrphaned Heap
  • ③ Pass-by-Value (Methods)Call Stack
  • ④ null, NPE & Garbage CollectionInteractive GC
LAB 02 · ARRAYS & LOOPS 4 Scenarios

Loops & 2-D Arrays

Trace row-major vs. column-major nested loops cell-by-cell, see why unlabeled break exits only the inner loop, and debug jagged-array bounds crashes.

Included Trace Scenarios
  • ① Row-Major Traversalgrid[r][c]
  • ② Column-Major & Diagonalr == c
  • ③ break & continue SearchInner Exit
  • ④ Jagged Array & Bounds TrapOOB Crash
LAB 03 · OOP & DISPATCH 4 Scenarios

Polymorphism & Dynamic Dispatch

Separate compile-time type checking (javac) from runtime vtable method lookup, test safe instanceof downcasting, and avoid static/field hiding traps.

Included Trace Scenarios
  • ① Upcasting & Method Overridevtable Climb
  • ② Compile Error vs. Downcastinstanceof
  • ③ Polymorphic Array LoopAnimal[] zoo
  • ④ Static & Field Hiding TrapStatic Binding

Recommended Classroom Progression

1
Start with Stack, Heap & References

Once students see that variables hold memory addresses (@4a2f) rather than objects themselves, aliasing and method parameters become intuitive.

2
Move to Loops & 2-D Arrays

Connect reference semantics to int[][] (an array of row references) and trace how outer and inner loop counters move at different rates.

3
Finish with Polymorphism & Dynamic Dispatch

Combine Stack reference types (checked by javac) with Heap object types (resolved at runtime via vtable) to demystify inheritance.

Built for Live Instruction & Self-Study

  • Pause-and-Predict Checkpoints: Key steps include collapsible "Show question" prompts with hidden answers so students can predict outputs before stepping forward.
  • Interactive What-If Toggles: Trigger Garbage Collection on orphaned Heap objects in Lab 1, or toggle an instanceof pattern-match fix for a compile error in Lab 3.
  • Zero-Setup & Keyboard/Touch Friendly: Runs completely client-side with ← / → arrow keys on projectors and swipe gestures on phones.