Create a Correct Parent Sealed Class

Sealed types are a new idea for Java developers, let IntelliJ IDEA guide you in how to use them.

Sealed classes (a preview feature in Java 16) are a way to take control of the inheritance hierarchy of our classes. If we have a sealed class like this one, IntelliJ IDEA will tell us we need to "permit" the child class so it can extend this parent. It will also automatically make changes if it can.

Experiment with Sealed Types, use Alt+Enter (Windows/Linux) to see and accept suggestions.

Interested in JVM Development?

call to action image

You can create a sealed child too!

Learn More


Related Resources

Add a Breakpoint
Add a Breakpoint
Add breakpoints when you get an exception in your code.
Create a new class
Create a new class
Create a new class and a new package.
Inlay Hints
Inlay Hints
Inlay hints provide additional information about your code.