wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes enums' ordinal ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "enums Watch "enums New topic
Author

enums' ordinal ?

Mamadou Touré
Ranch Hand

Joined: Dec 27, 2007
Posts: 189
Hi,

I was doing the mock exam provided with the CD of B&K book, when I come accross something strange, a method called ordinal(). There is nowhere in the book were we talked about this method for the enums . Do you have an idea of what it is ?

Regards
[ May 16, 2008: Message edited by: Bear Bibeault ]

SCJP 5 (76%)
SCWCD 5 (86%)
SCBCD 5(70%)
--------------------
"The greatest glory in living lies not in never falling, but in raising every time we fall.".. Nelson Mandela
Joe Fischer
Greenhorn

Joined: May 02, 2008
Posts: 25
Description of the ordinal() method is in the Sun Javadocs for the java.lang.Enum class. It's the 0-based position of the enum in the declaration of enums. Also says it's not very useful except for specialized collections. Other than that I don't know why you would want to know the declared position of an enum.


SCJP-SE6.0
Mamadou Touré
Ranch Hand

Joined: Dec 27, 2007
Posts: 189
Thanks Joe,

As I said, I encoutered it on the mock exam provided with the K&B CD.
 
wood burning stoves
 
subject: enums' ordinal ?
 
Similar Threads
Start java enum ordinal at 1 instead of 0
doubt regarding enum in java 1.5
Locales and Ordinal values
Last day before SCJP5
Enum doubt