OK, I did basically what I had below but had to encaspulate color in
its own separate class rather than in the nested class.
public class Color {
/**
* this is privvy to the instance
*/
private String color;
/**
* the constructor is private - I don't want just anyone creating
* colors
*/
private Color(String c) {
color = c;
}
public static final Color RED;
static {
RED = new Color("RED");
}
}
So now if you want a color:
Color c = Color.RED;
and you can't do (which is what I wanted)
Color c = new Color("RED");
I would have preferred to do this:
Fruit.Color c = Fruit.Color.RED;
but you can't have static members in nested classes.
oh well... there are times I really miss C++ :-)