为了账号安全,请及时绑定邮箱和手机立即绑定

您好,在以下代码中,请问this.day=day 在下面是什么意思?

您好,在以下代码中,请问this.day=day 在下面是什么意思?

慕田峪7331174 2021-07-22 15:15:54
public enum WeekDay { Mon("Monday"), Tue("Tuesday"), Wed("Wednesday"), Thu("Thursday"), Fri( "Friday"), Sat("Saturday"), Sun("Sunday"); /**定义枚举类型自己的属性**/ private final String day; private WeekDay(String day) { this.day = day; } /**定义枚举类型自己的方法**/ public static void printDay(int i){ switch(i){ case 1: System.out.println(WeekDay.Mon); break; case 2: System.out.println(WeekDay.Tue);break; case 3: System.out.println(WeekDay.Wed);break; case 4: System.out.println(WeekDay.Thu);break; case 5: System.out.println(WeekDay.Fri);break; case 6: System.out.println(WeekDay.Sat);break; case 7: System.out.println(WeekDay.Sun);break; default:System.out.println("wrong number!"); } } public String getDay() { return day; } }
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 288 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信