枚举
enum Grade{
A("100-90"),B("89-80"),C("79-70"),D("69-60"),E("59-0");
private String value;
private Grade(String value){
this.value = value;
}
public String getValue(){
return this.value();
}
}
enum Grade{
A("100-90"){
public Strig localValue(){
return "优";
}
}
,B("89-80"){
public Strig localValue(){
return "良";
}
}
,C("79-70"){
public Strig localValue(){
return "一般";
}
}
,D("69-60"){
public Strig localValue(){
return "差";
}
}
,E("59-0"){
public Strig localValue(){
return "不及格";
}
};
private String value;
private Grade(String value){
this.value = value;
}
public String getValue(){
return this.value();
}
public abstract Strinf localValue();
}
enum A{
A;
}
//枚举常用方法
Grade.C.name()
Grade.C.ordinal()
Grade.valueOf(Grad.class,str)
Grade.values()