Java Code Visualizer
Paste your own Java into Debug and step through it line by line — variables, the call stack, the heap and the output — or open one of the worked examples.
Press Debug to run this code step by step.
Variables, the call stack and the heap appear here once the code runs.
What it understands
Primitives and String, the full operator set, if/else, for, while, do-while and enhanced-for, break/continue/return, 1-D and 2-D arrays with .length, classes with fields, constructors, instance and static methods, new, this, single inheritance with super(...), overriding and polymorphism, abstract classes and methods, interfaces with constants, default and static methods, null, and System.out.print/println.
Not supported, and refused by name rather than mis-run: generics, lambdas, try-catch, instanceof, collections like ArrayList and HashMap, threads, file IO, imports beyond java.lang, nested and anonymous classes, switch and enums.
private, public and protected are accepted and shown, but access is not enforced — the visualizer traces what your code does, it is not a compiler.
Green arrows are references. A variable holding an object or array never contains it — it points at the heap, which is why b = a makes both change together.