When my code gave the wrong output, all I could do was add more print statements. So I built WriteCode: a free online compiler that also lets you debug and see your code run step by step.

What you can do

  • ▶️ Run code: Java, Python, C, C++, JavaScript, SQL and more
  • ⌨️ Type input while the program runs, like a real terminal
  • 🐞 Debug: set breakpoints and step through line by line
  • 👀 Visualize: arrays, linked lists, trees and recursion drawn as they change
  • 🗄️ Real MySQL for SQL practice

No sign-up. Works on phones too.

Try this

Paste this Java code, then press Visualize:

public class Main { static class Node { int val; Node next; Node(int val) { this.val = val; } } public static void main(String[] args) { Node head = new Node(1); head.next = new Node(2); head.next.next = new Node(3); Node prev = null, cur = head; while (cur != null) { Node next = cur.next; cur.next = prev; prev = cur; cur = next; } } } 

You'll watch the arrows flip one by one as the list reverses.

👉 writecode.in

What should I add next? I'd love your feedback! 🙌
WriteCode visualizer showing a Java linked list being reversed step by step, with arrows for cur, head and prev