public enum DetailEnum { SYSTEM("1","社区服务"), ConSULTING("2","咨询服务"), LIVE("3","直播服务"), ORDER("4","订单状态服务"), SHOPPING("5","商城服务"), Mail("7","邮件服务"); private String type; //类型 private String desc; //描述 private DetailEnum (String type,String desc){ this.type=type; this.desc=desc; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; }}class Test{ public static void main(String[] args){ DetailEnum detail=DetailEnum .SYSTEM; //每个枚举成员实际上是一个枚举实例 System.out.println(detail.getType()); System.out.println(detail.getDesc()); }}
java枚举类实例应用
时间:2023-07-07
相关推荐