dcsimg

How do I create an enumeration?

John Zukowski

Starting in Java 5, you can use the new enum keyword, where you would specify a class or interface. For instance, for a enumeration of suits from a deck of cards, you might use: public enum Suit { CLUBS, DIAMONDS, HEARTS, SPADES }.