If you look at the API, you'll see that name() and valueOf() are defined there.
Actually valueOf(String) isn't documented anywhere in the javadocs. I don't know why.
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Joined: Feb 07, 2005
Oops, you're right.
Only the one that takes two arguments in the docs.
The Java Language Specification does show the valueOf(String) method being associated with enum in 8.9 Enums, although it doesn't show up in the API docs or in the source code. [ April 19, 2007: Message edited by: Keith Lynn ]
Every enum has two extra static methods: valueOf() and values(). The reason they're not documented in the java.lang.Enum API is because they're static methods of each Enum subclass, not of the Enum class itself. Since they're static, they don't override anything in Enum, and there's no way to declare them abstract in the base class. So there's really no logical place to put such a method in Enum. That's why they're described in the JLS instead.
"I'm not back." - Bill Harding, Twister
Joined: Jan 29, 2005
Yes, I can see it.
I think something is wrong if I cannot use the language simply by looking up the API documentation.
Where has the good ole Java gone. Something comprehensible like C++ only portable. Since the 1.5 it's not what it used to be. Mainly due to the generics thing. A language should be a productive tool. Not something that I have to struggle with merely for the purpose of struggling. [ April 19, 2007: Message edited by: Joseph Sweet ]