This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes regarding enums Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "regarding enums" Watch "regarding enums" New topic

regarding enums

Saral Saxena
Ranch Hand

Joined: Apr 22, 2011
Posts: 202

Hi Foks,

Why we use new Enums to declare the constants, 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

Joined: Apr 06, 2010
Posts: 4343

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.
jQuery in Action, 2nd edition
subject: regarding enums
Similar Threads
alternative for interface
when to use Enum
enum static methods