1 Introducing modern Java


This chapter covers

  • Java as a platform and a language
  • The new Java release model
  • Enhanced Type inference (var)
  • Incubating and preview features
  • Changing the language
  • Small language changes in Java 11

Welcome to Java in 2022. It is an exciting time. Java 17, the latest Long-Term-Support (LTS) release shipped in September 2021, and the first and most adventurous teams are starting to move to it.

At the time of writing, apart from a few trailblazers, Java applications are more or less evenly split between running on Java 11 (released September 2018) and the much older Java 8 (2014). Java 11 offers a lot to recommend, especially for teams that are deploying in the cloud, but some have been a little slow to adopt it.

So, in the first part of this book, we are going to spend some time introducing some of the new features that have arrived in Java 11 and 17. Hopefully, this discussion will help convince some teams and managers who may be reluctant to upgrade from Java 8 that things are better than ever in the newer versions.

Our focus for this chapter is going to be Java 11 because a) it’s the LTS version with the largest market share and b) no noticeable adoption of Java 17 has occurred yet. However, in chapter 3, we will introduce the new features in Java 17 to bring you all the way up to date.

1.1 The language and the platform

1.2 The new Java release model

1.3 Enhanced type inference (var keyword)

1.4 Changing the language and the platform

1.4.1 Sprinkling some sugar

1.4.2 Changing the language

1.4.3 JSRs and JEPs

1.4.4 Incubating and preview features

1.5 Small changes in Java 11

1.5.1 Collections factories (JEP 213)

1.5.2 Remove enterprise modules (JEP 320)