Sealed classes are used for representing restricted class hierarchies, when a value can have one of the types from a limited set, but cannot have any other type. They are, in a sense, an extension of enum classes: the set of values for an enum type is also restricted, but each enum constant exists only as a single instance, whereas a subclass of a sealed class can have multiple instances which can contain state.
Sealed classes are available in languages like Kotlin, or C#. Tagged unions are common on Swift and Rust.
We highly recommend reading the Rationale for the readme of JavaSealedUnions for an indepth explanation of the idea and application of the library.