Why would I use an Enum, and not just a class?

Viewed 1725

I was helping a friend with Java the other day, and they were asking about Enums. I explained that the C syntax of (something like)

enumeration Difficulty{
    BEGINNER= 1;
    PRO=5;
    EXPERT = 11;
}

Wasn't the way to go, the Java syntax is something(1); you made a constructor that accepted an int and then did this and that...etc.

But they stopped me and asked "If we're using constructors and so on, why bother with an enum, why not just have a new class?"

And I couldn't answer. So why would you use an enum in this case, and not a class?

7 Answers
Related