Java in 2026 is WAY Better
Java in 2026 is WAY Better
Do you remember Java in the 2000s? All the AbstractFactorFactoryInterfacePimpl patterns. Using 17 objects in a 100 line chain of function calls just to database? The insane boilerplate just to write "Hello World"? Java has (had?) a reputation as garbage for a reason, but I think we all need to update our knowledge of the language.
In the intervening 20 years Java has significantly improved, and I thought it'd make for an interesting deep dive into why that is.
I'm not doing a Java Course, but I get enough requests for Java that I took the time to research how and why to learn it in 2026. If you enjoy this kind of content, then check out my other courses. All of my courses are 15% off and buying a course helps me write other useful content like this email.
1. Simple Scripting-Like Usage
You no longer need tons of imports and a complicated main() to write simple programs. You can write code like this:
void main() {
IO.println("Hello World.");
}
Then run it with a simple command like most any other scripting language:
java mycode.java
I also find that it starts up and runs at about the same speed as most other languages like JavaScript and Python. Not sure if that's a consequence of modern computer hardware or if they finally figured out nobody wants to wait around while a JIT compiles everything for the 1-millionth time.
2. Simpler IO
You can now use IO.println() instead of the abhorrent System.io.println(). That may not seem like a big deal but the first thing a beginner interacts with is the IO system. If it's complicated then it makes it harder to learn for no real reason.
3. Pattern Matching Switch Expressions
You can do pattern matching in a switch and use that as an expression:
void main() {
var delta = Float.valueOf(100.0f);
int time = switch(delta) {
case Float d when d > 1000.0f -> 100;
case Float d when d > 1000 && d < 10000 -> 10000;
default -> 0;
};
IO.println("Delta converted to time is: " + delta);
}
Now, this example is a bit rough because switch doesn't currently support "primitive patterns" so we have to convert the float to a Float object, but this is still a nice feature.
4. Record Types
If you just need an POJO (Plain Old Java Object) to store data, then thenew record will create everything you need in one line:
record Combatant(String name, int damage) {};
void main() {
var zed = new Combatant("Zed", 100);
IO.println("Combatant " +
zed.name() + " does " +
zed.damage() + " damage.");
}
Notice how this automatically gets .name() and .damage() accessors? Doing the same thing with a class would probably take about 20+ lines of code.
5. Lambdas
I'd say this is the weakest improvement to Java as the way Lambdas are implemented is in the most Java way possible:
import java.util.function.*;
void main() {
Function<Integer, Integer> f = (x) -> x + 10;
IO.println(f.apply(10));
}
I'm probably missing some information here, but having to use a whole object to implement a lambda just seems...Java.
6. Fancy Iterators
Java has the : style iterator you find in so many languages now:
for(var name : names) {
IO.println("Name: " + name);
}
Combined with var and generics and you get some nice usability.
7. Way Better String Formatting
You can now add almost anything to a string to format it, and there's a String.format() method for doing C style string formatting.
void main() {
int age = 100;
IO.println(String.format("Zed is %d years old.", age));
}
8. Generics
This is one of the older features so many of you probably know it, but you can now create generic data structures like many other languages. Look at the example for Lambdas and you see this line:
Function<Integer, Integer> f = (x) -> x + 10;
That's creating a Function that takes an Integer and returns an Integer.
9. var Type Inference
The compiler can now infer the types for you:
var name = "Hello!";
var age = 100;
var locations = new String[]{"Ohio", "Kansas", "Osaka"};
No need to repeat the type over and over for every variable.
10. Multi-Line Text Blocks
You can now write multi-line strings similar to Python with """:
var poem = """
This is
a poem of sorts
that reads like shorts
""";
Java will also remove any indentation in the string.
12. Project Valhalla
An exciting development in Java is Project Valhalla. This is a project that is modernizing the language to support modern CPU architectures. Here's a description from the above page:
Project Valhalla is augmenting the Java object model with value objects, combining the abstractions of object-oriented programming with the performance characteristics of simple primitives.
My understanding of this is changing the object model to allow for contiguous arrays of objects rather than "everything is a reference" to avoid cache misses and enable vectorization. However, it seems this has been in the works for...a decade? A really long time, and only now is available in early access.
Learning Java in 2026
If I had to learn Java in 2026 I'd read Modern Java by Ethan McCue. This course will work for total beginners all the way to advanced programmers who are new to Java. Last time I did Java was 20 years ago and I was able to relearn enough to make a little game with libgdx.
The next thing I would do is continue with libgdx and recreate the GNU Coreutils. Doing those things would be fun and I'd also learn how Java handles many operating systems APIs.
Tab Dump
To close things out here's the Java related tabs I have after my exploration:
- Modern Java
- Excellent course for learning modern Java that would work for total beginners or experts.
- libgdx
- Really nice 2D game engine. Slay the Spire was written in it.
- jMonkeyEngine
- Another game engine that looks really nice.
- LWJGL
- Lower level graphics library used by libgdx and others.
- Play
- Web framework with a nice API, but it's also very slow.
- Javalin
- Another web framework people have recommended, but also slow.
- Quarkus
- Yet another web framework with a nice API, but much faster than Play or Javalin.
- OpenJavaFX
- Recommended GUI and Game library that seems to be very capable.
- AwesomeJava
- Big 'ol list of even more things you may find interesting.
Help With C#
I'd like to do this same thing with C# since I also get many requests for C#. If you have any pointers on where to start learning C# feel free to reply and drop me your knowledge.
With C# I think I'd approach it in a similar way of learning the basics then using monogame to make a simple 2D game, but you tell me what you would do. How would you learn C# in 2026?
More emails we've sent.
25% Off 2026 Summer Sale
Announcing my 25% off Summer Sale for July.
How to Mic a Painting and a Keyboard
Summary
Announcing Art Guy Summer, 2026
I'm going to recover my Oil Painting skills by painting live on Twitch every day.
Java in 2026 is WAY Better
Summary