What is new in Java 25?
Java 25 (September 2025) is an LTS release, so it gets updates for many years. Some of the final features:
- Compact source files and instance main methods (JEP 512): small programs without the class and
public static, plusIO.println. - Module import declarations (JEP 511):
import module java.base;imports all the public packages of a module. - Flexible constructor bodies (JEP 513): statements before
super(...), for checks. - Scoped values (JEP 506): a safer way to share data between threads than thread locals.
- Compact object headers (JEP 519) and other performance work.
We can test the first three on a real Java 25:
import module java.base;
void main() {
List<String> names = new ArrayList<>(List.of("Riya", "Aman")); // List and ArrayList without a normal import
IO.println(names);
IO.println(new Child(-5).value());
}
class Parent {
final int value;
Parent(int value) { this.value = value; }
int value() { return value; }
}
class Child extends Parent {
Child(int raw) {
int fixed = Math.max(raw, 0); // a statement before super(...), allowed in Java 25
super(fixed);
}
}
Output
[Riya, Aman]
0
Java 27 is newer, but it is not an LTS. See the chapter Java Introduction for the versions.
Learn more about the similar topics:
| Tutorials |
|---|
| No Content Found. |
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |