break;
case RAINY:
System.out.println("It's rainy");
}
枚举类型可以有自己的构造方法,不过必须是私有的,也可以有其他方法的定义,如下面的代码:
public enum Weather {
SUNNY("It is sunny"),
RAINY("It is rainy"),
CLOUDY("It is cloudy");
private String description;
上一页 [1] [2] [3] [4] [5] [6] 下一页