• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Where are these methods documented

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Christophe Verré wrote:
How do you declare an enum as a class ?



Enums are compiled to a .class file.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic