This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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 ?
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.
Joined: Dec 27, 2007
As I said, I encoutered it on the mock exam provided with the K&B CD.