public class EnumTest {
public static void main(String[] args) {
WeekDay weekday2 = WeekDay.MON;
}
public enum WeekDay{
SUN(),MON(1),TUE(2),WED(2),THI(1),FRI,SAT;
private WeekDay(){
System.out.println("first");
}
private WeekDay(int day1,int day2){
System.out.println("third");
}
private WeekDay(int day){
System.out.println("second");
}
}
}
输出结果如下:
first
second
second
second //这两个怎么是“second”?不是为“third”么? 如果我想这两个“second”变成“third”,应该怎么做? 请指点下,谢谢!
second //你要看他们的重载方式 如果不把想两个“second”变成“third” 只需要对应的传入两个参数比如TUE(2,2),WED(2,2)
first
first |