Java online compiler and code runner
Run Java programs in your browser with zero setup. Write classes, test algorithms with `java.util.*`, and execute standard Java code directly.
Can I use Java Collections and Streams in this online compiler?
Yes. The compiler supports the full Java Collections Framework, allowing you to use ArrayList, HashMap, HashSet, PriorityQueue, and Streams.
Can I take user input in this online Java compiler?
Yes. Enter your custom input in the stdin box before running your code, and read it using Scanner or BufferedReader.
Popular Java examples
Scanner User Input
Reading integers and strings using java.util.Scanner.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter your name: ");
if (sc.hasNext()) {
System.out.println("Welcome, " + sc.next() + "!");
}
}
}Ready to practise real interview problems in Java?
Solve 370 curated problems merged from Striver A2Z, Love Babbar 450 and Apna College, with no duplicate questions.
Questions people ask
What should be the main class name?
Name your public class `Main` with the standard `public static void main(String[] args)` signature.
Can I run Java programs online without installing the JDK?
Yes. You can compile and run Java programs directly in your browser without downloading the JDK or setting environment variables. The compiler is free and ready to use immediately.
Which Java version runs here and what libraries are supported?
The environment runs modern OpenJDK runtimes, including OpenJDK 17 and 21. Standard Java libraries such as `java.util`, `java.io`, `java.math`, and the Stream API are available.
How do I pass user input to a Java program?
Click on the Input tab next to the console output to enter test data before running your code. Inside your Java program, read standard input using `java.util.Scanner` with `System.in` or `BufferedReader`. The runner feeds this text directly to stdin.
What are the execution limits for Java code?
Execution is capped at a CPU limit of 5 seconds and a wall-clock limit of 10 seconds per run. Programs run in an isolated sandbox with no outbound network access or persistent file storage. Code size must be under 20,000 characters and input under 4,000 characters.
Can I practice coding interview problems in Java here?
Yes. 356 of the 370 curated interview problems on DSA Tracker are graded on hidden test cases in Java. You can write your solution inside the problem workspace and submit it for automated grading.
Do I need to create an account to use the Java compiler?
No account or sign-in is required to compile and run Java code. An account is only needed if you want to track your problem progress or use monthly AI assistance credits.