本帖最后由 张旭峰 于 2014-4-29 22:19 编辑
好郁闷啊,为什么执行时无参构造也会被调用?大牛们给指点下啊!
package cn.itcast.day1;
public class EnumTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
WeekDay weekday=WeekDay.MON;
}
public enum WeekDay
{
MON("mon"),WEN;
private String day;
private WeekDay()
{
System.out.println("FIRST");
}
private WeekDay(String day)
{
this.day=day;
System.out.println(day);
}
} |