This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
An enum type is a type whose fields consist of a fixed set of constants. Common examples include compass directions (values of NORTH, SOUTH, EAST, and WEST) and the days of the week.
Because they are constants, the names of an enum type's fields are in uppercase letters.
The above is the definition of enum as given in Sun Doc,
basically its used for constants..
So why have been primitive constants disaalowed?
The "3" i gave in my enum declaration is not an identifier, its a constant which
is what enums are meant for..
BIG,HUGE,OVERWHELMING are all identifiers for a constant. 3 however is a constant and cannot be used as an identifier.
Something similar to this...
Joined: Jun 15, 2010
I have the above two classes.
In the second code block, an error occurs saying class Coffee already exists in the package.
Why does not the same thing occur for enum CoffeeSize as i have declared it in both the
blocks of code and enum is also a type of class?