Is it possible for enum to change its meaning (from within itself)? It may be easier to understand what I mean by code:
enum Rate { VeryBad(1), Bad(2), Average(3), Good(4), Excellent(5); private int rate; private Rate(int rate) { this.rate = rate; } public void increateRating() {
This is the desire I want to achieve:
Rate rate = Rate.Average; System.out.println(rate);
thanks
java enums
devoured elysium
source share