基础篇 java enum枚举类型用法小结
本文总结了一些有关java中enum枚举类型的用法,下面是一个示例:public enum EnumTest { FRANK("The given name of me"), LIU("The family name of me"); private String context; private String getContext() { return this.context; } private EnumTest(String context) { this.context = context; } public static void main(String[] args) { for (EnumTest name : EnumTest.values()) { System.out.println(name + " : " + name.getContext()); } System.out.println(EnumTest.FRANK.getDeclaringClass()); } }j