• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what are Enums?

 
Sunny Gibbony
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I noticed that from Java SE 1.4 to 1.5 that Sun added Enums. I am looking for a simple explanation on what Enums do and the definition of one.

Thanks
 
Ganesan Ramakrishnan
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Enums are constants, Like week days are constant , it wont change. you can put your project constant values into Enum classes.
 
Campbell Ritchie
Sheriff
Posts: 51469
87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean enumerated types with the keyword enum, not to be confused with the related class Enum and the unrelated interface Enumeration.

Try the Java Tutorials, in the first instance, and see whether that helps.
 
Campbell Ritchie
Sheriff
Posts: 51469
87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, enum members are more than constants. Read the Tutorial link too, Ganzan Ramakrishnan. They are actually collected objects in their own right.
 
Campbell Ritchie
Sheriff
Posts: 51469
87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More in this thread, with different links.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic