Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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
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: 19680
    
  19

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: 3495
    
  13
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
 
Don't get me started about those stupid light bulbs.
 
subject: Can't find the method values() used for enums.