Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how do i override valueOf for an enum?

807606Jun 3 2007 — edited Jun 3 2007
I'm having troubles figuring out exactly how to override valueOf for an enum. ex:
public enum foo {
      a, b, c

     foo() {}
     
     public static ???? valueOf(String s) {
            return ????
     }
}
What's the correct class for the ??? so that it is overrides the method? Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 1 2007
Added on Jun 3 2007
10 comments
6,585 views