Your code called Scanner and is waiting for input.
This tool runs a real (but deliberately scoped) interpreter — not a fake animation. If your code uses something outside this list, you'll get a clear error with a line number instead of a silent failure.
int double float long boolean char String, and arrays of these — 1D and 2D (int[], int[][], jagged arrays too). Casts like (int) d, (double) x, (char) n, and reference downcasts like (Dog) animal.
Declarations (incl. multiple per line and final constants — reassigning a final variable is a real, catchable error), = += -= *= /= %=, ++/-- (pre & post), arithmetic, comparison, instanceof, && || !, the ternary ?:.
if / else if / else, for, while, do-while, enhanced for-each (for (int x : arr)), switch/case/default (with real fallthrough), break, continue, return. Switch expressions (Java 14+) — the arrow form returns a value directly: String s = switch (x) { case 1, 2 -> "low"; default -> "high"; };, with multi-value labels and a block-with-yield form for cases that need a few statements first. Pattern matching instanceof (Java 16+) — if (obj instanceof String s) checks the type and binds s in one step, no separate cast needed.
new int[5], new int[3][4], jagged arrays like new int[3][], array literals like {1,2,3} and {{1,2},{3,4}}, .length, bounds-checked indexing.
.length() .charAt(i) .substring(a) .substring(a,b) .equals(...) .equalsIgnoreCase(...) .toUpperCase() .toLowerCase() .indexOf(...) .contains(...) .trim() .strip() .stripLeading() .stripTrailing() .repeat(n) .isEmpty(), plus the static String.join(sep, ...) (accepts loose arguments or a List). var works for local variable declarations too (var x = 5;) — the type is inferred from the initializer. Integer.parseInt(s), Double.parseDouble(s), Boolean.parseBoolean(s) (and their .valueOf()/.toString() counterparts) convert between strings and primitives, throwing a catchable NumberFormatException on bad input.
.append(...) (chainable), .toString(), .length(), .reverse(), .insert(i,x), .delete(a,b), .deleteCharAt(i), .charAt(i), .setCharAt(i,c).
Static and instance methods, parameters, return values, recursion, and real method overloading — same name, different parameter count or type, correctly dispatched.
Classes with fields, overloaded constructors (several Rectangle(...) with different parameter lists, correctly resolved by argument count/type) and this(...) constructor delegation, plus this. Instance field initializers run automatically when an object is built (ArrayList<String> log = new ArrayList<String>(); as a field works, in declaration order, superclass fields first), and so do instance initializer blocks (a bare { ... } in the class body, run once per object before the constructor). A static { ... } block runs once per class, after static field initializers, before main. Instance fields and static fields (one copy shared by every instance — static int count = 0;), accessible as ClassName.field or as a bare name from inside the class's own methods (static or instance), with real final protection on both. Static methods too, including the ClassName.method(...) call form. Generic classes and methods — class Box<T>, class Pair<K, V>, static <T> T first(List<T> list) — type parameters are accepted and erased, same as real Java bytecode. Varargs — void sum(int... nums) — collects any number of trailing arguments into an array; also accepts a real array passed directly. A static nested class (class Outer { static class Node {...} }) is supported for the common case of hand-building data structures, registered under its own simple name. Full single-inheritance via extends: super(...) constructor chaining, super.method(), method overriding with real dynamic dispatch. abstract classes/methods. interface with implements (including multiple interfaces, and generic ones like Comparable<T>). instanceof. Access modifiers are parsed but not enforced.
A label before a loop (search: for (...) { ... }) lets break search; or continue search; target that specific loop from anywhere nested inside it — not just the innermost one. Works across for, for-each, while, and do-while, and a labeled break can also target a labeled switch.
Override public String toString() on any class and it's used automatically by println/print and string concatenation (including objects inside a List/Set/Map); without an override you get the real Java default, ClassName@hash. Override equals(Object o) for value-based comparisons; without one, .equals() correctly falls back to reference equality, same as Object. hashCode() defaults to a stable per-object id. enum types are fully supported — simple (enum Day { MONDAY, TUESDAY }) and "rich" enums with their own constructor and fields (enum Planet { MERCURY(3.3e23); double mass; Planet(double m){...} }), plus .values(), .valueOf(...), .name(), .ordinal(), and bare constant names in switch cases.
Implement Comparable<T> and a compareTo(T o) method, then sort with Collections.sort(list) (natural order) or Collections.sort(list, comparator) (custom order — accepts a lambda like (a,b) -> a.x - b.x or a class implementing Comparator). Also Collections.min/max/reverse/shuffle and Arrays.sort/toString/asList/fill.
Math.sqrt/pow/abs/max/min/round/floor/ceil/log/log10/exp/cbrt/hypot/signum/toRadians/toDegrees/sin/cos/tan/random, plus Math.PI and Math.E. String.format(...) and System.out.printf(...) support %s %d %.Nf %c %b %n %% with width/left-justify (%-10s). Bitwise and shift operators & | ^ ~ << >> >>> work with real Java int (32-bit) semantics and correct operator precedence. new Random(seed) gives a seeded, reproducible sequence (.nextInt() .nextInt(bound) .nextDouble() .nextBoolean()) — a plain new Random() defaults to a fixed seed so a run is repeatable, which deviates from real Java's non-deterministic default but matters more for a step-debugger.
Lambda expressions in every common form — x -> x*2, (a, b) -> a + b, () -> { ... } with a block body — including capturing local variables from the enclosing method (closures). Works with custom functional interfaces (a single-method interface) as well as built-in spots like the Collections.sort comparator. Method references — Class::staticMethod, obj::method, String::toUpperCase (unbound instance reference), and Class::new (constructor reference). List.forEach(...) and .stream() with a real chainable pipeline: .filter() .map() .sorted() .distinct() .limit() .skip() .forEach() .reduce() .collect(Collectors.toList()/.toSet()/.joining()) .count() .sum() .average() .anyMatch() .allMatch() .noneMatch() .min() .max().
ArrayList<T> / LinkedList<T> — .add() .get() .set() .remove() .size() .isEmpty() .contains() .clear() .forEach() .stream() .iterator(). HashMap<K,V> / TreeMap<K,V> — .put() .get() .containsKey() .remove() .keySet() .values() .size() .forEach(); a TreeMap always iterates and prints in key-sorted order. HashSet<T> / TreeSet<T> — .add() .contains() .remove() .size() .forEach() .stream() .iterator(); a TreeSet always iterates and prints in sorted order. Iterator<T> — list.iterator() / set.iterator() gives back .hasNext() .next() .remove() (the safe way to delete from a collection while iterating it). PriorityQueue<T> — natural ordering or a custom comparator (new PriorityQueue<>((a,b) -> ...)); .add()/.offer() insert, .poll()/.peek() always return the smallest. ArrayDeque<T> / Deque<T> — double-ended: .push() .pop() for stack use, .addFirst() .addLast() .removeFirst() .removeLast() .peekFirst() .peekLast() for queue/deque use. All work with enhanced for-each. Generic type arguments like <String> are accepted and erased at runtime, same as real Java. LinkedList uses the same internal array-backed model as ArrayList (not a true linked-node structure) — the API behaves identically, only the internal visualization is simplified.
Real, catchable try / catch / finally (finally always runs), multi-catch (catch (A | B e)), throw, custom exception classes (class MyException extends RuntimeException), built-in exception types constructed directly (throw new IllegalArgumentException("bad input")), and .getMessage(). try-with-resources — try (Connection c = new Connection(...)) { ... } calls .close() on the resource automatically when the block ends, even if an exception is thrown; multiple resources close in reverse declaration order. Built-in runtime errors — ArithmeticException, ArrayIndexOutOfBoundsException, NullPointerException, ClassCastException, etc. — are real, catchable exceptions now, not just fatal messages. catch (Exception e) correctly catches any subclass. throws clauses are parsed and ignored (no checked-exception enforcement). Stack overflow and the step-limit safety net are never catchable, by design.
import ...; and package ...; lines are accepted and ignored, so you can paste in real textbook code as-is.
System.out.println(...), System.out.print(...), and System.out.printf(...).
outer.new Inner()) — nested classes work, but are modeled like static nested classesLinkedList (it works, but is modeled like ArrayList internally)HashMap/HashSet beyond reference equality (no custom .equals()/.hashCode() bucketing)java.util.function.Function — use the unqualified form (Function) as you would with an importPrograms are capped at 20,000 execution steps and 200 levels of recursion, so a runaway loop or missing base case fails gracefully instead of freezing the page.