本帖最后由 深知一生短暂 于 2013-9-10 15:26 编辑
public static void main(String[] args) {
// TODO Auto-generated method stub
//System.out.println("who's your daddy?");
WeekDay weekDay2=WeekDay.FRI;
System.out.println(weekDay2);
/* System.out.println(weekDay2.name());
System.out.println(weekDay2.ordinal());
System.out.println(WeekDay.valueOf("SUN"));
System.out.println(WeekDay.values().length);
*/}
public enum WeekDay
{
SUN(1),MON,TUE,WED,THI,FRI,SAT;
private WeekDay()
{System.out.println("first");}
private WeekDay(int day)
{System.out.println("second");}
}
运行结果:
second
first
first
first
first
first
first
FRI
这让我很头痛,为什么有那么多个first |