请编写一个关于星期几的枚举WeekDay

public class Demo {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String str=Grade.Sunday.getValue();
String str1=Grade.Sunday.toLocalGrade();
System.out.println(str+"...."+str1);

}

}

package csdn.hbsi.cn;

enum Grade{
Monday("Monday") {
@Override
public String toLocalGrade() {
// TODO Auto-generated method stub
return "星期一";
}
},
Tuesday("Tuesday") {
@Override
public String toLocalGrade() {
// TODO Auto-generated method stub
return "星期二";
}
},
Wednesday("Wednesday") {
@Override
public String toLocalGrade() {
// TODO Auto-generated method stub
return "星期三";
}
},
Thursday("Thursday") {
@Override
public String toLocalGrade() {
// TODO Auto-generated method stub
return "星期四";
}
},
Friday("Friday") {
@Override
public String toLocalGrade() {
// TODO Auto-generated method stub
return "星期五";
}
},
Saturday("Saturday") {
@Override
public String toLocalGrade() {
// TODO Auto-generated method stub
return "星期六";
}
},
Sunday("Sunday") {
@Override
public String toLocalGrade() {
// TODO Auto-generated method stub
return "星期日";
}
};

private String value;

private Grade(String value){
this.value=value;
}

public String getValue() {
return value;
}

public abstract String toLocalGrade();

}

你可能感兴趣的:(请编写一个关于星期几的枚举WeekDay)