public static void main(String[] args) {
// TODO Auto-generated method stub
Weekday weekday=Weekday.SUN;
//System.out.println(weekday==SUN);这个地方为什么不是TRUE.此时的weekday与SUN不都是Weekday类型的引用吗?同时指向new Weekday()对象吗
//System.out.println(weekday.toString());
System.out.println(weekday.nextDay().toString());
标红色的那个地方应该错了吧,是Weekday.SUN吧。那么打印结果就为true了,因为都是静态的指向的方法区同一个地址。
} |