Java, Java8, Java21, Java17, Migration.
{...} In this example, Circle, Rectangle, Triangle and Square are explicitly marked as permitted subclasses of Shape. The Square class is declared as non-sealed, which means it’s not final and can be further extended by classes outside the current package. Key features of sealed classes Controlled