Sealed classes restrict which other classes can extend them.
Sealed classes in Java allow you to specify a limited set of subclasses, controlling the hierarchy and preventing unauthorized subclassing. This is useful in scenarios where you want to maintain strict control over the class hierarchy, like in an e-commerce system where only specific types of payments should be allowed. By using sealed classes, you ensure that only predefined types can extend a class, which helps in maintaining a predictable and safe system design.