public enum Size {
SMALL("小学生"),MIDDLE("中学生"),BIG("大学生");
private String descrption;
private Size(String descrption) {
this.descrption=descrption;
}
public String getDescription() {
return descrption;
}
public static void main(String[] args) {
for (Size size : Size.values()) {
System.out.println(size+":"+size.getDescription());
}
}
}
现实枚举里多个构造方法
最新推荐文章于 2023-10-24 22:54:15 发布