For as long as I’ve written Java, every program has started the same way:

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

That’s a class nobody asked for, three modifiers, and an array nobody used, all before the one line that does anything. Since Java 25, this is enough:

void main() {
    IO.println("Hello, world");
}

Save it as Main.java, run java Main.java, and it works. There’s no class declaration, no public, no static, no String[] args, and no separate javac step.

Reading input gets the same treatment. This used to be the way to ask for a number:

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("How old are you? ");
        int age = scanner.nextInt();
        System.out.println("Next year you'll be " + (age + 1));
    }
}

Now it’s this:

void main() {
    int age = Integer.parseInt(IO.readln("How old are you? "));
    IO.println("Next year you'll be " + (age + 1));
}

IO.readln prints the prompt and returns the whole line as a String, so you parse it yourself instead of calling nextInt. You also skip the classic Scanner trap where nextInt leaves the newline behind for the next nextLine to swallow.

Good riddance.

Most people won’t care

A lot of code isn’t typed by hand anymore. An editor template or an AI assistant writes the boilerplate, so it hardly matters to anyone whether the entry point takes one line or five.

But I typed that line thousands of times. I learned it before I understood any of it. Every Java tutorial began with “ignore these words for now, we’ll explain them later”. You needed lessons on access modifiers, static members and arrays just to print a line of text.

For those of us who wrote all of that by hand for years, seeing it become optional is a relief.

The details most people might miss

The change is JEP 512, “Compact Source Files and Instance Main Methods”. Most people will never open it, but a few details are worth knowing:

  • The old signature still works. Nothing was removed, and existing programs run exactly as before. public static void main(String[] args) is gone as a requirement, not from the language.
  • main can be an instance method. If it isn’t static, the launcher creates the class through its non-private no-argument constructor and calls main on that instance.
  • args is optional. If you need command-line arguments, write void main(String[] args). When both exist, the launcher picks the version that takes String[].
  • You don’t need a class. In a compact source file, top-level methods and fields go into a class the compiler declares for you. Other code can’t refer to that class by name, which is fine for a script or a first program.
  • IO replaces the stream juggling. java.lang.IO has print, println and readln. Reading a line of input no longer means wrapping System.in in a Scanner or a BufferedReader.
  • Common imports come free. A compact source file automatically imports everything java.base exports, so List, Map and friends work without import lines.

A small change that matters

This won’t make a service faster or a system more reliable. Production code still has packages and classes, and a framework usually owns the entry point anyway.

What it changes is the first five minutes. A Java program can now start with the thing you actually want to do. That matters for students, quick scripts, and experiments you’d otherwise have done in another language.

After all these years of typing it, I won’t miss it. I know every Java developer who cares is happy and jumping right now, so good f*cking riddance to all of that boilerplate.

If you’re one of the people who care, go out and have a party. Enjoy celebrating this loss. You’ve earned it.