This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes doubt regarding enum in java 1.5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "doubt regarding enum in java 1.5" Watch "doubt regarding enum in java 1.5" New topic

doubt regarding enum in java 1.5

anveshana bandu
Ranch Hand

Joined: Oct 09, 2007
Posts: 42
Hi All

I came to know about a method ordinal() in enums.. in master exam in K&B book.

But i donot know what ordinal method does???so i was unable to attend the bit in master exam....
please let me know what ordinal method does???

Thanks in advance
Sandip Sarkar
Ranch Hand

Joined: Nov 25, 2007
Posts: 55
check out the java 1.5 is a little bit of description and its self explanatory....anywayz if you find it hard to get let me know so that i can code a bit to make you understand...

public final int ordinal()Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant is assigned an ordinal of zero). Most programmers will have no use for this method. It is designed for use by sophisticated enum-based data structures, such as EnumSet and EnumMap.

the ordinal of this enumeration constant

I agree. Here's the link:
subject: doubt regarding enum in java 1.5
It's not a secret anymore!