System.out.println("Hello GeeCon 2025!"); } } When was the last time you wrote... • Modern Java might surprise you • Today's journey: Discovering how Java has evolved 3
boilerplate-heavy • Slow and memory-hungry • Enterprise-only, not for modern applications • Unchanging and stagnant • Losing ground to newer languages • Not relevant in the AI revolution 4
expressive • High-performance with optimized JIT and GC • Full-stack and cloud-native • Rapidly evolving (6-month release cycle) ◦ Project Amber - improving language feature ◦ Loom- virtual threads ◦ Panama - foreign function and memory ◦ Valhalla - value object, enhancing generics ◦ Leyden - improving startup ◦ Babylon -extending Java's reach to foreign programming models • Growing ecosystem and community • A critical player in AI infrastructure and deployment • 🔄 Incremental, backwards‑compatible upgrades 5
and safety. • Works in conditional contexts such as instanceof and switch if (x instanceof String) { String str = (String) x; // use str } if (x instanceof String str) { // use str } 10
> 3) { // use str } else { // you do something else. } switch (x) { case String str when str.length() > 3 -> { // use str } case Integer n when n < 0 -> { System.out.println("value is zero or lower"); } default -> { // you do something else. } } 11
PlusExpr, TimesExpr { static int eval(Expr expr) { return switch (expr) { case ConstantExpr(var i) -> i; case NegExpr(var i) -> -eval(i); case PlusExpr(var a, var b) -> eval(a) + eval(b); case TimesExpr(var a, var b) -> eval(a) * eval(b); }; } } record ConstantExpr(int i) implements Expr {} record PlusExpr(Expr a, Expr b) implements Expr {} record TimesExpr(Expr a, Expr b) implements Expr {} record NegExpr(Expr a) implements Expr {} void main(){ IO.println(Expr.eval(new PlusExpr(new ConstantExpr(5), new ConstantExpr(20)))); } It took 19 lines of code, which would have taken 60 lines using traditional Java. 16
var cos = linker.downcallHandle( linker.defaultLookup().find("cos").get(), FunctionDescriptor.of(C_DOUBLE, C_DOUBLE) ); double v = (double) cos.invoke(1.0); 17
Interactive REPL for immediate code testing, API exploration, and learning, eliminating the need for full class boilerplate for simple tasks. • Single-File Execution (Java 11+): Run .java files directly (java Filename.java) without a separate compilation step, enabling Java for scripting. • Expanded Standard Library: More built-in utility methods (e.g., String.strip(), Files.writeString(), new HttpClient in Java 11) reduce dependency on external libraries. • Modern IDEs (IntelliJ, VSCode, Eclipse) offer robust support for new Java features. • Build tools (Maven/Gradle) effectively manage modular JDKs and multi-release JARs. 18
writes, speaks at conferences, and contributes to open-source projects outside of regular work hours. • Founder and current moderator of the Java User Group in Bangladesh (since 2013) • Recognized as the Most Valuable Blogger (MVP) at DZone, a leading technology publisher. • Serves as an editor for the Java Queue at InfoQ and at Foojay.io, a community for OpenJDK enthusiasts. • Authored five bestselling books about the Java programming language in Bengali. https://x.com/bazlur_rahman rokon12 https://www.linkedin.com/in/bazlur/ https://bazlur.ca/ https://bsky.app/profile/bazlur.ca 24