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 }.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact