/**
* 定义一个枚举数据
*
* @author Mike
*
*/
public enum Color {
//枚举数据
Yellow("Yellow color"),
//枚举数据
Green("Green color");
private String value="";
private Color(String value){
this.value=value;
}
public String getValue(){
return this.value;
}
}
-----------------------应用-------------------------
public class EnumTest {
public static void main(String [] args){
System.out.println(Color.Yellow);
System.out.println(get(Color.Yellow));
System.out.println(Grade.A);
}
public static String get(Color color){
return color.getValue();
}
public enum Grade {
A, B, C, D, F, INCOMPLETE
};
}