28
JDK 28
Planned for Mar 2027
Planned for Mar 2027
From JDK 1.0 in 1996 to Java 27 in 2026. Search for a feature to find the version that introduced it, or plan an upgrade between any two versions.
See everything you gain, and everything that was removed, between two versions.
Java 25 to 27 spans 2 releases, with 7 finished features to adopt and 2 removals or restrictions to check before you migrate.
28 releases since 1996, newest first.
void main() {
String name = IO.readln("Your name: ");
IO.println("Hello, " + name);
}List<List<Integer>> batches = Stream.of(1, 2, 3, 4, 5, 6, 7)
.gather(Gatherers.windowFixed(3))
.toList(); // [[1, 2, 3], [4, 5, 6], [7]]try {
Integer.parseInt(input);
return true;
} catch (NumberFormatException _) { // unnamed variable
return false;
}try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
requests.forEach(r -> executor.submit(() -> handle(r)));
}No finished features in this release; it only previewed or incubated 7 features. Turn on “Include previews and incubators” to see them.
sealed interface Payment permits Upi, Card {}
record Upi(String vpa) implements Payment {}
record Card(String last4) implements Payment {}record Point(int x, int y) {}
if (obj instanceof Point p) {
System.out.println(p.x());
}String sql = """
SELECT id, title
FROM course
WHERE level = ?
""";String kind = switch (day) {
case SATURDAY, SUNDAY -> "Weekend";
default -> "Weekday";
};var client = HttpClient.newHttpClient();
var req = HttpRequest.newBuilder(URI.create("https://api.example.com/courses")).build();
String body = client.send(req, HttpResponse.BodyHandlers.ofString()).body();var lessonsByCourse = new HashMap<String, List<Lesson>>();List<String> langs = List.of("Java", "Kotlin", "Scala");
Map<String, Integer> ports = Map.of("http", 80, "https", 443);names.stream()
.filter(n -> n.startsWith("A"))
.map(String::toUpperCase)
.forEach(System.out::println);try (BufferedReader r = Files.newBufferedReader(path)) {
return r.readLine();
} // r is closed automaticallyList<String> names = new ArrayList<String>();
for (String n : names) {
System.out.printf("Hello %s%n", n);
}