Is the enum definition given below correct?
public enum PrinterType { private int pagePrintCapacity; // #1 DOTMATRIX(5), INKJET(10), LASER(50); // #2 private PrinterType(int pagePrintCapacity) { this.pagePrintCapacity = pagePrintCapacity; }//from w w w .j a v a 2s .c om public int getPrintPageCapacity() { return pagePrintCapacity; } }
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.