1 enum Season { 2 3 Spring("春天","123"),Summer("夏天","123"); 4 private String Name; 5 6 private String Dsc; 7 8 Season(String name, String dsc) { 9 Name = name; 10 Dsc = dsc; 11 } 12 }
1 package enum_; 2 3 public class Test { 4 5 public static void main(String[] args) { 6 System.out.println(Week.Friday); 7 } 8 } 9 10 11 enum Week { 12 13 Monday,Tuesday,Wednesday,Thursday,Friday; 14 15 }
Enum主要的成员方法