CodeCompiler
F
Main.java
>_
Live Console
Click Run to start

Java Online Compiler

Write, Run & Share Java code online using OneCompiler's Java online compiler for free. It's one of the robust, feature-rich online compilers for Java language, running on the latest version 17. Getting started with the OneCompiler's Java editor is simple and pretty fast.

About Java

Java is a very popular general-purpose, class-based, object-oriented programming language, created by James Gosling at Sun Microsystems and released in 1995. Java runs on the JVM, making it platform independent.

Key features

  • Free
  • Online
  • Real-time output
  • Easy & fast
  • No setup or installation required

Hello World

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

Variables

Java is statically typed — you must declare a variable's type.

int age = 25;
String name = "Alice";
boolean active = true;

Loops

for (int i = 0; i < 5; i++) {
    System.out.println(i);
}