Hello, World!
public class Main {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}Tap Run to execute
Main.java · output appears here
Press Run to execute
Output streams here as your program runs.
Java is a statically typed, class-based, object-oriented language created by James Gosling at Sun Microsystems and released in 1995. Designed around the principle of write once, run anywhere, Java source is compiled to bytecode that runs on the Java Virtual Machine, providing portability across platforms. It features automatic memory management, strong typing, and a vast standard library.
Today Java powers a huge share of enterprise backends, Android applications, big-data systems, and financial platforms. Its mature ecosystem includes frameworks like Spring and build tools like Maven and Gradle. This compiler runs Eclipse Temurin Java 25.0.3 in Java 25 release mode, without preview features or third-party Maven dependencies. The JVM's stability and performance keep Java central to large, long-lived codebases.
Main.java is the entry point. Add helper files from the explorer and import them into your project.
Use the Input panel to pipe standard input to your program when it needs data.
Run sends your code to a fresh hosted runtime and streams the result into the output panel.
Your draft stays in this browser, and Share creates a separate snapshot link.
Main.java and Helper.java compile together in the default package.
public class Main {
public static void main(String[] args) {
System.out.println(Helper.answer());
}
}
final class Helper {
static int answer() { return 42; }
}
public class Main {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String name = sc.nextLine();
System.out.println("Hello, " + name + "!");
}
}public class Main {
public static void main(String[] args) {
String[] fruits = {"apple", "banana", "cherry"};
for (int i = 0; i < fruits.length; i++) {
System.out.println((i + 1) + " " + fruits[i]);
}
}
}public class Main {
static long factorial(int n) {
return n <= 1 ? 1 : n * factorial(n - 1);
}
public static void main(String[] args) {
System.out.println(factorial(5));
}
}public class Main {
public static void main(String[] args) {
try {
int x = Integer.parseInt("abc");
System.out.println(x);
} catch (NumberFormatException e) {
System.out.println("Invalid number: " + e.getMessage());
} finally {
System.out.println("Done");
}
}
}import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] args) {
Map<Character, Integer> counts = new HashMap<>();
for (char c : "banana".toCharArray()) {
counts.merge(c, 1, Integer::sum);
}
System.out.println(counts);
}
}import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Main {
public static void main(String[] args) {
List<Integer> nums = new ArrayList<>(List.of(3, 1, 2));
Collections.sort(nums);
System.out.println(nums);
}
}public class Main {
static class Person {
String name;
int age;
Person(String name, int age) {
this.name = name;
this.age = age;
}
String describe() {
return name + " (" + age + ")";
}
}
public static void main(String[] args) {
Person p = new Person("Ada", 36);
System.out.println(p.describe());
}
}import java.util.List;
import java.util.stream.Collectors;
public class Main {
public static void main(String[] args) {
List<Integer> nums = List.of(1, 2, 3, 4, 5);
List<Integer> evens = nums.stream()
.filter(n -> n % 2 == 0)
.map(n -> n * n)
.collect(Collectors.toList());
System.out.println(evens);
}
}public class Main {
static String day(int n) {
return switch (n) {
case 1, 7 -> "weekend";
default -> "weekday";
};
}
public static void main(String[] args) {
System.out.println(day(1));
System.out.println(day(3));
}
}The editor uses Monaco, the engine behind VS Code, with language-aware editing tools and familiar keyboard controls.
Type or paste your code into the editor, then click Run (or press Ctrl/Cmd + Enter) to execute it.
Output streams into the console panel, including runtime errors, exit status, and execution time.
Nothing to install and no account to create — code runs in an isolated hosted runtime.
Language-aware autocomplete and IntelliSense suggestions where the editor has a matching language service
Syntax highlighting, with native compiler and runtime errors shown in the console
Bracket matching, auto-indentation, code folding, and a minimap
Multi-cursor editing plus find & replace (Ctrl/Cmd + F)
Full undo/redo history and copy to clipboard
Built on Monaco — the same editor that powers VS Code
Run on demand, or turn on Auto-run to execute on every change
Stop long-running or infinite programs at any time
A real console shows standard output, errors, exit status, and execution time
Pass standard input (stdin) to your program from the Input panel — one value per line
Switch between light and dark themes
Adjust font size and other editor settings
Toggle side-by-side or top/bottom layouts
Enter distraction-free fullscreen mode
Generate a shareable link to your exact code in one click — no login needed
Your work autosaves to your browser, so you can pick up where you left off
Copy the active file to your clipboard
Run code: Ctrl/Cmd + Enter
Find & replace: Ctrl/Cmd + F
Open the full shortcut list from the keyboard icon in the toolbar
Java is one of 23 linked-project compilers. Run always starts Main.java; selecting a helper tab changes what you edit, not the entry file.
Main.java and Helper.java compile together in the default package.
Linked-project languages (23): Node.js, TypeScript, Deno, Python, C, Go, Dart, Swift, Rust, Ruby, PHP, Java, Kotlin, C++, C#, Nim, Crystal, Haxe, Zig, Scala, D, Bun, Objective-C.
Single-file scratchpads (46): Matplotlib, NumPy, pandas, Haskell, Clojure, Perl, Lua, Tcl, jq, Raku, Elixir, Bash, Zsh, Nushell, R, Assembly (NASM), Julia, Octave, Groovy, PowerShell, Visual Basic .NET, Odin, Pascal, Lisp, Erlang, CoffeeScript, COBOL, BASIC, V, Racket, OCaml, Prolog, AWK, Emacs Lisp, Emojicode, Forth, F#, Fortran, Assembly (NASM64), Solidity, Mojo, Ada, WASM (WAT), Gleam, Shell Script (sh), Scheme. Their extra project files are not submitted to the runtime.
Download project exports every Java tab and a README in one ZIP archive.