
Sealed classes and interfaces
Java introduces the Sealed classes and interfaces as a preview feature in JDK 15 (JEP 360) and JDK 16 (JEP 397). Now, finalized the feature in JDK 17 (JEP 409), with no changes from JDK 16.
I have gone through this article https://tedblob.com/sealed-classes-and-interfaces-in-jdk-17/. Compared to Kotlin sealed class, this provides more control on what subclasses can extend a class. Kotlin sealed class would have package-private visibility whereas Java sealed class provides more fine-grained control.