Java枚举类简单应用

121 阅读1分钟
public enum  ColorType {

    RED("红色","red"),
    YELLOW("黄色","yellow"),
    BLUE("蓝色","blue"),
    BLACK("黑色","black");

    private String color;
    private String value;

    ColorType (String color,String value){
        this.color = color;
        this.value = value;
    }

    public String getColor() {
        return color;
    }

    public String getValue() {
        return value;
    }
}