public Weekday nextDay(){//此处报错,说nextDay方法在此处永远不会被用
return SUN;
}
};
public final static Weekday MON=new Weekday(){};
public String tostring(){
return this==SUN?"SUN":"MON";
}
}
复制代码
此处并无语法错误,按程序的原意,可以运行并得到相应的结果,楼主是不是之前有其他地方出错了?作者: tshch1989 时间: 2013-3-29 00:06
class Weekday {
private Weekday(){
}
public final static Weekday SUN=new Weekday(){
public Weekday nextDay(){//此处报错,说nextDay方法在此处永远不会被用
return SUN;
}
}.nextDay();
public final static Weekday MON=new Weekday(){