密封类

image.png
通过sealed关键字,定义密封类, 通过permits指定谁可以继承这个类
子类必须是密封类, 或者final修饰的, 或者非密封的 非密封的通过non-sealed修饰

二次预览(Record)

image.png