• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Where are these methods documented

 
Harsh Pensi
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q.1. I'm not able to find the static values() method and the valueOf(String s) method for enums in the java.lang.Enum<E> specification. Where is this documented?

Q.2. Also, can we run the main method inside an enum as in code below?
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As to #1, start here: http://java.sun.com/docs/books/tutorial/reflect/special/enum.html

As to #2, what happened when you tried?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Murtuza Arzai wrote:Q.1. I'm not able to find the static values() method and the valueOf(String s) method for enums in the java.lang.Enum<E> specification. Where is this documented?

In the Java Language Specification
 
Harsh Pensi
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:
As to #2, what happened when you tried?

I tried to run this from RAD, but no corresponding class found to run.

@Christopher, I got both these methods mentioned there, but these must be associated with some Class and so why they are not found in the java 6 API spec?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Murtuza Arzai wrote:
@Christopher, I got both these methods mentioned there, but these must be associated with some Class and so why they are not found in the java 6 API spec?

These are implicitly declared static methods.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried to run this from RAD, but no corresponding class found to run.

How do you declare an enum as a class ?
 
Harsh Pensi
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christophe Verré wrote:
How do you declare an enum as a class ?


Enums are compiled to a .class file.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic