public abstract class WeekDay{
private WeekDay(){}
public final static WeekDay SUN = new WeekDay(){
@override
public WeekDay nextDay(){
return MON;
}
};
public abstract WeekDay nextDay();
程序中定义了抽象类和方法,但是为什么要在静态对象中实现?作者: 王冀 时间: 2011-12-24 21:45
因为无法直接用new创建WeekDay的对象(构造方法私有,并且是抽象类)