I want to do the Java equivalent of this C++ code, where the first variable enumerated equals one, not zero, and the rest of the variables count up from that. I already tried the correct C++ syntax below but it didn't work. How can I do this?
enum Example { valOne = 1, valTwo, valThree };
Question about enums in Java...?
enum supported is added in Java 5.0 but it seems that you can't assign a value to enum's element like in C++. There is a way to emulate C++ behaviour. Read the article in links section.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment