java enum 实际上是类,但构造方法私有化,不允许直接new对象。
package basic;
public class Score {
private String sc;
private Score(String sc){
this.sc=sc;
}
public static final Score A=new Score("100-90");
public static final Score B=new Score("90-80");
public static final Score C=new Score("80-70");
public static final Score D=new Score("70-60");
public String getSc(){
return sc;
}
public void setSc(){
this.sc=sc;
}
}