While other platforms are waiting for the official release buzz to die down, we've already launched our course. We don't wait for everyone to discuss the new Java — we create the course right away 💪
When we launched CodeGym in 2014, our goal was simple — give people practical programming skills, not pretty presentations about "how important it is to study the basics." Over 10 years, more than 2 million people have taken our courses. Now we've created the world's first course on Java 25, and I want to tell you what's interesting there.
Compact Source Files — Java for Beginners
The most noticeable change in Java 25 is the simplified syntax for newcomers. Now you can write programs without explicitly declaring classes:
// Previously you needed this
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
// Now this is enough
void main() {
IO.println("Hello, World!");
}
If a .java file has methods or fields outside an explicit class declaration, the compiler automatically creates an implicit top-level class. For those learning programming, this significantly lowers the barrier to entry.
Instance Main Methods — without static and String[]
Java 25 allows using instance methods as program entry points. No more need to explain to beginners what static means:
void main() {
// Regular instance method
processData();
}
void processData() {
IO.println("Processing data...");
}
If a class doesn't have a suitable static main method, the Java launcher looks for an instance main method and automatically creates a class instance.
java.lang.IO — Simple Input/Output
The new java.lang.IO class simplifies console work. No more need to remember System.out.println:
void main() {
String name = IO.readln("Enter your name: ");
IO.println("Hello, " + name + "!");
}
The class is in the java.lang package, so it's available without import. There are methods for output, input, and reading strings with prompts.
Flexible Constructor Bodies — Flexible Constructors
In Java 25, you can perform operations before calling super() or this():
public class User {
private final String email;
private final String domain;
public User(String email) {
// Operations before super() call
this.domain = extractDomain(email);
validateDomain(domain);
super(); // Call Object constructor
this.email = email;
}
private String extractDomain(String email) {
return email.substring(email.indexOf('@') + 1);
}
}
This allows initializing fields and performing validation before object creation, making constructors more natural.
Module Import Declarations — Simplified Imports
JEP 511 introduces the ability to import all module packages with one line:
import module java.base;
// Now all classes from java.base are available without explicit imports
void main() {
var list = new ArrayList<String>();
var file = new File("data.txt");
var decimal = new BigDecimal("123.45");
}
This is especially useful when working with large modules where you need many classes.
Stable Values — Optimized Constants
New API for working with immutable values that can be initialized later:
class Configuration {
static final StableValue<String> DATABASE_URL =
StableValue.of(() -> loadFromConfig("db.url"));
void connectToDatabase() {
String url = DATABASE_URL.get(); // Lazy initialization
// Database connection
}
}
Stable Values help optimize application startup time and provide thread-safety for deferred initialization.
Primitive Types in Patterns — Extended Pattern Matching
Java 25 extends Pattern Matching to all primitive types:
static String classify(Number n) {
return switch (n) {
case int i -> "Integer: " + i;
case long l -> "Long: " + l;
case double d -> "Double: " + d;
case float f -> "Float: " + f;
default -> "Unknown number type";
};
}
Now you can use pattern matching with int, long, double, float, and other primitives in switch expressions and instanceof.
Compact Object Headers — Memory Savings
In Java 25, object header sizes are reduced from 96-128 bits to 64 bits on 64-bit architectures:
// Each object now takes less memory
List<String> list = new ArrayList<>(); // Less overhead
Map<String, User> users = new HashMap<>(); // Savings on each entry
This is especially noticeable in applications with large numbers of objects — microservices and applications with large heaps.
Scoped Values — Safe Context
The final version of Scoped Values allows passing immutable data between methods and threads:
private static final ScopedValue<User> CURRENT_USER = ScopedValue.newInstance();
public void handleRequest(User user) {
ScopedValue.where(CURRENT_USER, user)
.run(() -> {
processOrder(); // Inside, access user via CURRENT_USER.get()
sendNotification();
logActivity();
});
}
Unlike ThreadLocal, Scoped Values are easier to use, have lower overhead, and work better with virtual threads.
JFR Improvements — Better Profiling
Java 25 improves Java Flight Recorder with three new capabilities:
JFR Cooperative Sampling — safer stack trace collection without bias and with concurrent stack walking support.
JFR Method Timing & Tracing — tracking execution time of specific methods without code changes:
java -XX:StartFlightRecording:jdk.MethodTiming#methods=com.myapp.Service.* MyApp
CPU-Time Profiling on Linux — precise CPU time profiling using Linux kernel capabilities.
Key Derivation Functions API
New API for working with key derivation functions (KDF):
// Example of using KDF for generating derived keys
KeyDerivationFunction kdf = KeyDerivationFunction.getInstance("PBKDF2WithHmacSHA256");
SecretKey derivedKey = kdf.deriveKey(password, salt, iterations, keyLength);
This is critically important for cryptographic applications and implementing secure password storage.
Why Learn Java 25
Java evolves quickly — new LTS versions come out every 3 years. Those who master the new features first get an advantage in the job market.
Java 25 is an LTS release with 5 years of support from Oracle. Companies will migrate to this version and look for developers who know the new language capabilities.
The First Java 25 Course
When Oracle announced the Java 25 release date, we decided not to wait. CodeGym has always been ahead — we were first to create gamified programming education, first to create interactive tasks with auto-checking.
Now we're the first to give you the opportunity to learn Java 25 hands-on. The course includes both Java 25 novelties and important features from previous versions — lambdas and Stream API from Java 8, modules from Java 9, var from Java 10, Text Blocks from Java 13, Records from Java 14, Pattern Matching from Java 17, Virtual Threads from Java 21.
What's in the course:
- 325+ lectures explaining each Java 25 novelty
- 880+ tasks from simple to enterprise-level
- AI mentor that analyzes code and gives recommendations
- IntelliJ IDEA integration — learn with professional tools
- Large projects — create real applications with new technologies
Practice — The Foundation of Learning
Over years of teaching, I understood a simple truth: theory without practice is a waste of time. You can read all the documentation about Compact Source Files, but until you write several programs with the new syntax, you won't feel the convenience.
In the course, each Java 25 novelty is immediately reinforced with practice. Learn Flexible Constructor Bodies — write a safe object initialization system. Master Scoped Values — create a multi-threaded application with context passing. Understand Module Import Declarations — simplify the structure of large projects.
AI Mentor in the Course
The most interesting feature of our course is the AI that analyzes student code. This isn't generic advice from ChatGPT, but a specialized system that:
- Knows the context of each course task
- Analyzes programming style
- Gives personalized recommendations
Gamified Learning
Programming can be boring if you study it wrong. That's why CodeGym education is built like a game: levels, achievements, ratings.
In the Java 25 course:
- Achievements for solving tasks of different difficulty
- General student leaderboard
- Game-like levels
From Zero to Job-Ready
The course is built so that even a beginner after 65 levels will have knowledge sufficient for work in a serious company. The complete course curriculum includes learning modern Java 25, but also covers:
- Modern syntax and new operators
- OOP with new language capabilities
- Collections and Stream API
- File operations through modern API
- Multithreading and thread management
IntelliJ IDEA Plugin
One of CodeGym's features is the IntelliJ IDEA plugin. Students solve tasks directly in a professional development environment, with syntax highlighting, auto-completion, and debugger.
Instant Solution Checking
In CodeGym, you can solve a task and find out the result in a couple of seconds. The system automatically checks code, runs tests, and gives feedback.
For Java 25, the checking system understands:
- New Compact Source Files syntax
- Instance Main Methods
- Flexible Constructor Bodies
- Module Import Declarations
Why CodeGym for Learning Java 25
Over 10 years of work, we've understood how to teach programming effectively. Recruiters in tech companies know CodeGym and often ask in interviews: "What's your level on CodeGym?" Not because we pay them for it, but because they know — if someone reached level 40, they can program, not just memorize syntax.
The Java 25 course is the evolution of our methodology. The same practical focus, but with the most modern technologies.
Start Learning Now
Java 25 is already out, and you can learn it now — while competitors are reading release notes. Our course contains all innovations with practical examples.
65 levels of practical tasks, AI mentor, integration with professional tools — everything so you master modern Java quickly and effectively.
Become a Java developer ready for 2025.
Ready to learn Java 25? Start at CodeGym — the only platform with a complete hands-on course on the newest version of Java. 65 levels | 880+ tasks | AI mentor | IDEA integration |
GO TO FULL VERSION