- public class TestWeek {
- public static void main(String[] args) {
- Week day1=Week.SAT;
-
- }
- public enum Week {
- MON("1"),TUE("2"),WED("3"),THU("4"),FRI("5"),SAT("6 "),SUN("0");
- String date;
- Week(String date){
- this.date=date;
- this.printDate();
-
- }
- public void printDate(){
- System.out.println(this.date);
- }
- }
- }
复制代码
输出结果竟然是
1
2
3
4
5
6
0
以为应该输出SAT对应的date嘛?
为何全部都出来了? 而不是只打一个6 |