class EnumTest
{
public static void main(String[] args)
{
WeekDay weekday = WeekDay.nextDay();
System.out.println(weekday);
}
}
abstract class WeekDay
{
private WeekDay(){}
public abstract WeekDay nextDay();
public static final WeekDay SUN = new WeekDay(){
public WeekDay nextDay()
{
return MON;
}
};
public static final WeekDay MON = new WeekDay(){
public WeekDay nextDay()
{
return SUN;
}
};
public static void main(String[] args)
{
}
}
编译出现静态不能访问非静态方法,可是我看张老师教程写的代码没有哪不一样呀。求找问题,求解
|
|