Introduction to Sealed Classes
--
Learn about fine-grained inheritance control in Java
Sealed classes feature was released in Java 17. However it was already available as a preview feature since Java 15 and revised in Java 16.
Sealed classes can restrict other classes or interfaces from extending or implementing them. In short, this feature allows the author to have a control which code is responsible for implementing…