代码:
package com.atguigu.java; /** * @Author: YanXu * @Description: * @Date 2022/8/22 11:57 */ public class meiju { public static void main(String[] args) { season spring = season.SPRING; System.out.println(spring); } } enum season{ SPRING("春天","春暖花开"), SUMMER("夏天","春暖"), COOL("秋天","花开"); private final String name ; private final String desc ; season(String name, String desc) { this.name = name; this.desc = desc; } public String getName() { return name; } public String getDesc() { return desc; } @Override public String toString() { return "season{" + "name='" + name + '\'' + ", desc='" + desc + '\'' + '}'; } }