package com.example.demo; import java.io.PrintStream; // Referenced classes of package com.example.demo:// ab public class EnumTest{ public EnumTest(){} public static transient void main(string args[]) {ab a = ab.aaa; /* anonymous class not found */ class _anm1 {} switch(_cls1..SwitchMap.com.example.demo.ab[a.ordinal()]) { case 1: // '\001'system.out.println("aaa"); // fall through case 2: // '\002'system.out.println("bbb"); // fall through default:return; } }} 取得 enum 的ordinal(); ordinal() 方法是public final 类型的,不可被override。