Are you interested in knowing what are the new featured introduced in Java 17? Are you also interested in knowing what are the deprecated features in Java 17? If so, then reached the right place. This is the second part of the feature in java 17. You can access the first part of the features of Java 17 here.
In the previous article, we explored the Java 17 features such as JEP 412: Memory API and Foreign Function, JEP 411: Deprecate the Security Manager, JEP 414: Vector API, JEP 415: Deserialization Filters.
In this article, we will focus on the features below in Java 17
1. JEP 409: Sealed classes
2. JEP 406: Pattern Matching for switch
3. JEP 403: Strongly Encapsulate JDK internals
4. JEP 398: Deprecate Applet API for removal
B ) JEP 409: Sealed classes
A sealed class that restricts other classes may extend it. This also applies to interface as well i.e a sealed class can be an interface that restricts another interface may extend it.
With Java 17, new sealed, non-sealed character sequences are introduced and it allows them as contextual keywords.
C ) JEP 406: Pattern Matching for switch
With this change, all existing expressions and statements compile with identical semantics. It performs then without any modification.
There are two new patterns are introduced
1. Guarded Pattern: It is used to refine the pattern matching logic using a boolean expression
2. Parenthesized Pattern: It is used to get rid of parsing ambiguities
D ) JEP 403: Strongly Encapsulate JDK internals
All the internal elements of JPK are strongly encapsulated. Here only exception is sun.misc.unsafe.
E ) JEP 398: Deprecate Applet API for Removal
As we know Applet APIs were deprecated since Java 9 but these were never removed. With Java 17, these will be removed there not be much impact because these Applet APIs are no longer in use as we use more advanced web technologies for it.
Learn more about Java here -