1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
public class Sealed { public abstract sealed class Parent permits Child1, Child2 { } public final class Child1 extends Parent { } public abstract non-sealed class Child2 extends Parent { } public sealed interface SealedInterface permits ChildInterface1 { } public non-sealed interface ChildInterface1 extends SealedInterface { } }