This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regarding enums

 
Saral Saxena
Ranch Hand
Posts: 203
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Foks,

Why we use new Enums to declare the constants,..is it they are type safe, can be used within switch loop, can be declared outside class..!! please explain me what the functionality of enums ...pleasure if you guys can provide a small demo of it..!!that will be a great help to understand
 
Matthew Brown
Bartender
Posts: 4567
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Google "java enum" and the first hit is the Java tutorials section on enums, which contains a couple of examples.

The type-safety is the main reason, but because of they way enums are implemented in Java (enums are just specialised classes) they have some other convenient features.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic