//利用类来解释枚举内部原理
public abstract class WeekDayClass {
private WeekDayClass() {
}
public final static WeekDayClass Sun = new WeekDayClass(){//匿名内部类
@Override
public WeekDayClass nextDay() {//重写nextDay方法
return Mon;
}
};
public final static WeekDayClass Mon = new WeekDayClass(){
@Override
public WeekDayClass nextDay() {
// TODO Auto-generated method stub
return Tue;
}
};
public final static WeekDayClass Tue = new WeekDayClass(){
@Override
public WeekDayClass nextDay() {
// TODO Auto-generated method stub
return Sun;
}
};