Home Audience Developers What’s New in Java 11?

What’s New in Java 11?


Every six months, the Oracle Corporation rolls out a new version of Java. The September 2018 release was Java 11. There’s quite a buzz in the computer world about this version. Java now comes in two versions – OpenJDK, which is open source and totally free, and the commercial version of JDK, which is free for developmental purposes but must be paid for in production. Take a look at the features of Java 11.

If you are in love with Java, you might already know that the Java Development Kit (JDK) version 11 is already out. One update of the JDK came out in March 2018, and the next version was released on September 25, 2018. Oracle Corporation is doing an excellent job by following a six-month release plan. Every new release comes with many significant changes. Let’s discuss what the JDK 11 offers users.

An introduction to Java 11

This release is the reference implementation of version 11 of the Java SE Platform, according to the Oracle Corporation. This is specified by JSR (Java Specification Request) 384 in the Java Community Process. JDK 11 comes with some surprises. From this version onwards, Oracle has changed the licence of JDK; so instead of having a single JDK build which was used either commercially or free, it now has two different JDK builds.

  1. Oracle’s OpenJDK (for open source): This is to be used for free in any environment, like any open source library.
  2. Oracle’s JDK (for commercial use): This is to be used in development and testing for free, but if you use it in production, you must pay for it. Oracle’s JDK is richer in features and is more stable, while performing better.

JDK 11 has significant changes, enhancements, removed APIs and features, as well as deprecated APIs and features. Formally, it marks a monumental shift in the Java ecosystem. With the challenges of migrating from Java 8 onto a modular and flexible JDK, with the six-month release cycle, with the new licensing and the long-term support models, we’ve entered a new era! Now the code bases must follow and many projects will move from Java 8 directly to Java 11.

The newly added features of JDK 11 are:

  • Nest-based access control
  • Dynamic class-file constants
  • Improved Aarch64 intrinsics
  • Epsilon: A no-op garbage collector
  • The Java EE and CORBA modules have been removed
  • HTTP client (standard)
  • Local-variable syntax for lambda parameters
  • Key agreement with Curve25519 and Curve448
  • Unicode 10
  • Flight recorder
  • ChaCha20 and Poly1305 cryptographic algorithms
  • Can launch single-file source-code programs
  • Low-overhead heap profiling
  • Transport layer security (TLS) 1.3
  • ZGC: A scalable low-latency garbage collector (experimental)
  • Deprecates the Nashorn JavaScript engine
  • Deprecates the Pack200 tools and API

Developer oriented features of Java 11

1. Local-variable syntax for lambda parameters: This has been added to simplify code as you no longer need to declare the type of a local variable, but can use ‘var’. It allows var to be used when declaring the formal parameters of implicitly typed lambda expressions, something like what’s shown below:

(var x, var y) -> x.process(y);

var is permitted only for the formal parameters of an implicitly typed lambda expression.

2. Single file source code programs: For the simple ‘Hello World’ application, we need to write about six to ten lines of code. To simplify this process, JDK 11 has come up with the single file launch of source code. That means it eliminates the need to compile a single file application and directly runs them for results. In source file mode, the source file is compiled into memory, and the first class found in the source file is executed. For example, if a file called HelloWorld.java contains a class called HelloWorld, then the command:

java HelloWorld.java

…is equivalent to:

javac HelloWorld.java

java helloWorld

3. HTTP client (standard): JDK 9 introduced a new API to provide support for the HTTP client protocol as the incubator module. This feature is an enhancement to the HTTP API of JDK 9 and now is part of JDK 11, which is completely asynchronous. The flow of data can now be more easily traced, from the user level request publishers and response subscribers all the way down to the underlying socket.

4. Removal of the Java EE and CORBA modules: This removal requires applications to explicitly depend upon Java EE and CORBA modules if required. Applications will have no connection to Web Services or XML but rely on individual classes in the Java EE APIs for general-purpose functionality.

5. Newl APIs: Many new APIs have been added in this version of the JDK, including the HTTP client and flight recorder. Major changes have been done in java.io, java.lang, java.nio, java.util, and many more.

These are some of the exciting changes in JDK 11, which is available for download from Oracle’s official site. You can download either OpenJDK or OracleJDK, depending on your requirements.

JDK 12 will be the next LTS release of the JDK (as defined by Oracle). Stay tuned for more such updates on Java.



Please enter your comment!
Please enter your name here