标签:
public enum Color{ //定义枚举并赋值 RED("红色", 1), Blue("蓝色", 2), Yellow("黄色", 3); private String colorName; private int colorCode; //public String .... 其他public方法 private Color(colorName, colorCode){ this.colorName = colorName; this.colorCode = colorCode; } public String getColorName(){ return colorName; } public void setColorName(name){ this.colorName = name; } public int getColorCode(){ return colorCode; } public void setColorCode(code){ this.colorCode = code; } }
标签:
原文地址:http://www.cnblogs.com/xbingxin/p/4286591.html