I'm not sure what you're trying to accomplish. If you want to use an enum you should not create a class but an enum. The Oracle Java Tutorial section about enums can be found here.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Sharon whipple
Ranch Hand
Joined: Jul 31, 2003
Posts: 294
posted
0
Wouter Oet wrote:I'm not sure what you're trying to accomplish. If you want to use an enum you should not create a class but an enum. The Oracle Java Tutorial section about enums can be found here.
I m trying to inherit legacy class implementing enum and adding functionality..
Then I would not use the name Enum because it will confuse people with the enum functionality of the java language.
But about your problem. I'll give you a hint by rename it:
Sharon whipple
Ranch Hand
Joined: Jul 31, 2003
Posts: 294
posted
0
Unfortunately Animal cannot be changed because it is used by other APIs, adding values to Animal is impossible.
I didn't get it, you will still get ClassCastException on Dog b = Dog.EVALUE;
What is the difference?