public class MyClass {
public enum Color {
RED("#FF0000"),
GREEN("#00FF00"),
BLUE("#0000FF");
private String code;
private Color(String code) {
this.code = code;
}
@Override
public String toString() {
return code;
}
}
public static void main(String args[]) {
String red = Color.RED.toString();
String green = Color.GREEN.toString();
String blue = Color.BLUE.toString();
System.out.println(red);
System.out.println(green);
System.out.println(blue);
}
}
/*
run:
#FF0000
#00FF00
#0000FF
*/