支持的,代码如下
public class SeasonTest{
public enum Season{SPRING, SUMMER, AUTHMN, WINTER };
public static void main(String[] args){
Season s= Season.SPRING;
switch (s) {
case SPRING:
System.out.println("SPRING");
break;
case SUMMER:
System.out.println("SUMMER");
break;
case AUTHMN:
System.out.println("AUTHMN");
break;
default:
System.out.println("WINTER");
break;
}
}
}
不过,建议看下黑马的视频,里面的视频讲的更清楚。
|