标签:
1 public class TestEnum { 2 public enum MyColor{ red , blue ,green }; 3 4 public static void main (String[] args){ 5 MyColor m = MyColor.red; 6 switch(m) { 7 case red: 8 System.out.println("red"); 9 break; 10 case blue: 11 System.out.println("blue"); 12 break; 13 case green: 14 System.out.println("green"); 15 break; 16 default: 17 System.out.println("default"); 18 } 19 System.out.println(m); 20 } 21 }
标签:
原文地址:http://www.cnblogs.com/roger-h/p/4464239.html