Java 简明教程

Java 11 - New Features

Java 11 是 Java 8 后第一个 LTS,即长期支持功能版本。它遵循在 Java 10 之后引入的 Java 发行节奏,并于 2018 年 9 月发布,距离 Java 10 发布仅仅 6 个月。

Java 11 is the first LTS , Long Term Support feature release after Java 8. It followed the Java release cadence introduced Java 10 onwards and it was released on Sept 2018, just six months after Java 10 release.

Java 9 和 Java 10 是非 LTS 版本。Java 11 版本是 LTS 版本。

Java 9 and Java 10 are non-LTS release. Java 11 release is a LTS release.

New Features

以下是 Java 11 中引入的主要新功能。

Following are the major new features which are introduced in Java 11.

  1. JEP 321HTTP Client API standardized.

  2. JEP 330Launch Single-File Source-Code Programs without compilation

  3. JEP 323Local-Variable Syntax for Lambda Parameters

  4. JEP 181Nest-Based Access Control

  5. JEP 331 − Low-Overhead Heap Profiling

  6. JEP 318 − Epsilon, A No-Op Garbage Collector

  7. JEP 333 − ZGC A Scalable Low-Latency Garbage Collector

  8. Collection API Updates − New Collection.toArray(IntFunction) Default Method.

  9. String API Updates − New methods added like repeat(), isBlank(), strip() and lines().

  10. Files API Updates − New methods added like readString(), and writeString().

  11. Optional Updates − New method added, isEmpty().

Java 11 通过新的方法和选项增强了大量 API,并删除了不推荐使用的 API 和选项。我们将在后面的章节中看到这些更改。

Java 11 enhanced numerous APIs with new methods and options and removed deprecated APIs and options. We’ll see these changes in next chapters.

Useful Links