Java 25 Release History
Java 25 is a Long-Term Support (LTS) release that reached General Availability on September 16, 2025.
As an LTS version, it is designed for stability and long-term enterprise use. Oracle provides Premier Support until September 2030, with Extended Support continuing until September 2033. This makes it the recommended version for new production deployments.
Below are the key features introduced in this release:
Compact Source Files (Java 25)
Formerly known as Implicitly Declared Classes, this feature simplifies the structure of Java programs. It removes the need for explicit class declarations and static main methods for small programs.
void main() { System.out.println("Hello, Java 25!"); }Flexible Constructor Bodies
This feature relaxes the rule that
super()must be the first statement in a constructor. You can now execute logic (like validation) before calling the parent constructor, provided you don’t access the instance under construction.public PositiveBigInteger(long value) { if (value <= 0) throw new IllegalArgumentException("non-positive value"); super(String.valueOf(value)); }Module Import Declarations
Allows importing all packages exported by a module with a single statement. This significantly reduces the number of import statements needed in a file.
import module java.base; void main() { List<String> list = new ArrayList<>(); // from java.util File file = new File("test.txt"); // from java.io }Primitive Types in Patterns (Preview)
Extends pattern matching to support primitive types in
switchandinstanceof. This removes the limitation of only being able to use reference types in patterns.switch (value) { case byte b -> System.out.println("Small number: " + b); case int i -> System.out.println("Medium number: " + i); }