Loading Java...
Starting Java sandbox...
workspace.java
1
2
3
4
5
6
7
8
Output
Input (stdin)
Interactive sandbox awaiting execution...
JavaOpenJDK 21Live Cloud Sandbox

Online Java Compiler & Runner

Compile and execute Java online with OpenJDK 21. Perfect for practicing data structures, algorithms, and Java interview questions. With code.thecoder.in, you can write, compile, and execute Java code directly inside your web browser. No local SDKs, compilers, or configuration required.

Sub-Second Execution
Powered by high-performance serverless containers with pre-warmed compilers for near-instant execution feedback.
Standard Input (stdin)
Supply custom input datasets, simulate user prompts, and test multi-line edge cases with the interactive stdin tab.
Isolated & Secure
All code executes in an isolated private VPC container without network access, keeping your tests completely sandboxed.

Java Quick Syntax Reference

Main Class & Scanner

Class name must be Main for the online runner.

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
    }
}

Frequently Asked Questions (Java Compiler)

Must my class be named Main?

Yes, please name your public class `Main` with a standard `public static void main(String[] args)` entry point.