The Java Version Quiz

Over the last 30 years, Java has added many features, including generics, lambdas, pattern matching, and records. You surely know that lambdas have been introduced in Java eight and records in Java 16, but can you distinguish the other Java versions?

I felt I couldn’t, so I created a tiny little Java game: The Java Version Quiz. In this quiz, you get a Java snippet and have to decide between five different Java versions. Pick the smallest Java version where the snippet is valid code (without using preview features).

The screenshot shows the alpha version of the game, which includes features introduced in Java 1.0alpha2 and 1.0alpha3, including bug fixes. A game version for only the nerdiest of Java connaisseurs. Source is a dump of the alpha2 and alpha3 packages on GitHub.

The game focuses on Java language differences and major runtime differences, which are easy to check without semantic analysis. It’s a by-product of another fun little project.

I hope you learn some new features of Java and discover that it is evolving over the years, while still keeping the syntax similar enough that it’s hard to spot the differences between versions. And if you’re unsure what a specific feature in the shown code snippet is, the quiz gives you a handy description.

If you find any issues or have new code examples, feel free to contribute to the quiz on GitHub.

See you in another week for another blog post on something JFR-related.