is the enum definition given below correct?.
public enum Letter { private int v; // #1 B(5), A(10), C(50); // #2 private Letter(int v) { this.v = v; }// w w w . j a va 2 s . co m public int getValue() { return v; } }
B.
You need to define enum elements first before any other attribute in an enum class.
in other words, this enum definition will compile cleanly if you interchange the statements marked with "#1" and "#2" within comments in this code.