File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "enums Watch "enums New topic

enums' ordinal ?

Mamadou Touré
Ranch Hand

Joined: Dec 27, 2007
Posts: 189

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 ?

[ 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

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.

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.
I agree. Here's the link:
subject: enums' ordinal ?
jQuery in Action, 3rd edition