Sealed classes in Java provide explicit control over which classes can extend or implement a class/interface.They were introduced in Java 15 (preview) and finalized in Java 17, enforcing restricted inheritance and strong encapsulation.Sealed classes restrict which other classes or interfaces may extend or implement them, promoting controlled inheritance in the class hierarchy.For example, in a sealed class Shape, only Circle and Rectangle are allowed to extend it.