你不能
枚举类型在设计上是最终的。
原因是每个枚举类型都应 仅 具有 在枚举中声明的元素 (例如,我们可以在switch语句中使用它们),如果允许扩展类型,则不可能。
您可能会执行以下操作:
public interface MyInterface { // add all methods needed here}public enum A implements MyInterface { A, B; // implement the methods of MyInterface}public enum B implements MyInterface { C; // implement the methods of MyInterface}请注意,然后无法
switch使用此接口进行操作。(或者通常有一个
switch带有可能来自多个对象的对象
enum)。



