public abstract class WeekDay{
private WeekDay(){
}
public abstract WeekDay nextDay();
public final static WeekDay SUN = new WeekDay(){ //这边是创建一个匿名内部类并赋值给了WeekDay类型的SUN,由于WeekDay是个抽象类,所以要实现它的抽象方法nextDay()
public WeekgDay nextDay(){
return MON;
}
public final static WeekDay MON= new WeekDay(){ //同上
public WeekgDay nextDay(){
return SUN;
} 作者: 真真姐 时间: 2012-4-23 22:46