本帖最后由 灰太狼爱平底锅1 于 2014-3-8 21:14 编辑
- public class MeiJu {
- public static void main(String[] args) {
- WeekDay weekDay = WeekDay.MON;
- }
- 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
为什么会全部都初始化并打印出来了呢??
|