Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doubt regarding enum in java 1.5

 
anveshana bandu
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
check out the java 1.5 API...here 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.

Returns:
the ordinal of this enumeration constant

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Enum.html

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic