wood burning stoves 2.0*
The moose likes Java in General and the fly likes Anybody know how to use  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Anybody know how to use  "enum" in Java?" Watch "Anybody know how to use  "enum" in Java?" New topic
Author

Anybody know how to use "enum" in Java?

Jon Campbell
Greenhorn

Joined: Nov 21, 2006
Posts: 5
The following code compiles, but I don't have any documentation on how to use the "enum" structure. I cant find any info on it in my books or Sun's language documentation...

class Test {

enum eone {
Plus { int operate(int x) { return ++x;} },
Minus { int operate(int x) { return --x;} }
}


public static void main (String[] args){
System.out.println("eone="+eone.Plus);
}

}
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Anybody know how to use "enum" in Java?
 
Similar Threads
Refactoring int constant's to use enums
Using multiple enum
Convert from enum ordinal/constant to enum type
getClass() and enums
Anybody know how to use "enum" in Java?