Each color has its own static attribute - a number. I want to be able to change this value using a method. Can I do this with enumerations? Like this, or perhaps in a different way:
public enum Color {
RED, ORANGE, YELLOW;
}
Color.RED.setValue(x);
Color.RED.getValue();
Or did I need to do something like this, where color is a class?
public Red extends Color {
private static int x;
public int getRedValue(){
return x;
}
public void setRedValue(int x){
this.x = x;
}
}
source
share