Java Lost Enumerated Types

[Voting on JavaDesignFlaws page.]

C and C++ have "enum." Now Java does too. So why aren't you happy?

Shouldn't this link to the CeePlusPlusDesignFlaws? page, instead? :-)

Yes, I know you can define a class with "static const final" definitions of valid values, but that still doesn't give you an enumerated type -- the values aren't instances of the class, now are they?

See EnumeratedTypesInJava for a solution which is actually more useful than C/C++'s "enum".

I've seen this gripe a million times and you know, I've been working in Java for over two years now (with C++ before) and have not yet missed typedefs or enums... Just goes to show you can't be all things to all people.

Discussion of the advantages of EnumeratedTypes moved to that page.

Threadlet about whether Java is an OO language moved to ObjectOrientedProgramming.

Enumerated types have been added to Java 1.5, and yes they are proper class instances which means that you can do proper polymorphism.

View edit of January 16, 2009 or FindPage with title or text search