class="java">
protected Enum(String name, int ordinal) {
this.name = name;
this.ordinal = ordinal;
}
public enum Color {
RED,
YELLO,
GREEN;//此处分号可有可无
}
public enum Color {
RED(1),//
YELLO(2),
GREEN(0);//此处要有分号
private int value;
Color(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}