This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Can't find the method values() used for enums. 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 » Java » Beginning Java
Bookmark "Can Watch "Can New topic
Author

Can't find the method values() used for enums.

Nikolaos Plastiras
Greenhorn

Joined: Feb 08, 2012
Posts: 7

I am trying to find the static values() method that is used to iterate through enums in J2SE 6 documentation but I can't find it.
Is this the correct class?
public abstract class Enum<E extends Enum<E>> extends Object implements Comparable<E>, Serializable
Emanuel Kadziela
Ranch Hand

Joined: Mar 24, 2005
Posts: 186
it's not the Enum class, its the enum keyword, like this:

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

The values() method gets generated automatically for all enum classes. You can find it in the specific enum Javadoc page. For example check out TimeUnit.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3415
    
  12
It does get a mention in the Enum javadoc, but not as a separate method, just as an aside in the description of the valueOf method.


Joanne
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can't find the method values() used for enums.
 
Similar Threads
SCJP 5: Q on enums
Cannot understand enum class syntax
Iterating through unknown enum type variable
enum in Tiger
Getting a random element from an Enum