标签:[] out log class sys mat img nbsp main
1.如何定义枚举型
public enum gender{ GEN1("男","1"), GEN2("女","0"); private String name; private String value; private gender(String name,String value){ this.name=name; this.value=String.format("#gender option[value=‘"+"%s‘]", value); } public String getName(){ return this.name; } public String getValue(){ return this.value; } }
2.如何使用枚举型
public static void main(String[] args) { System.out.println(gender.GEN1.getName()); }
3.结果如下
标签:[] out log class sys mat img nbsp main
原文地址:http://www.cnblogs.com/sunny-sl/p/7762589.html