package cn.itcast.day1;
public class Weekday0 {
private Weekday0(){}
public static final Weekday0 SUN = new Weekday0();
public static final Weekday0 MON = new Weekday0();
public static final Weekday0 TUS = new Weekday0();
public static final Weekday0 WEN = new Weekday0();
public static final Weekday0 THU = new Weekday0();
public static final Weekday0 FRI = new Weekday0();
public static final Weekday0 SAT = new Weekday0();
public Weekday0 nextDay(){
if(this == SUN){
return MON;
}else if(this == MON){
return TUS;
}else if(this == TUS){
return WEN;
}else if(this == WEN){
return THU;
}else if(this == THU){
return FRI;
}else if(this == FRI){
return SAT;
}else{
return SUN;
}
}
public String toString(){
if(this == SUN){
return "SUN";
}else if(this == MON){
return "MON";
}else if(this == TUS){
return "TUS";
}else if(this == WEN){
return "WEN";
}else if(this == THU){
return "THU";
}else if(this == FRI){
return "FRI";
}else{
return "SAT";
}
}
}
原文地址:http://www.cnblogs.com/siashan/p/3840434.html