Given the code fragment:
Which is the valid definition of the Course enum?
A.
B.
C.
D.
Given the code fragment:
Which is the valid definition of the Course enum?
A.
B.
C.
D.
Answer D. the constructor cannot be public. enum cannot be final class. The method cannot be abstract if the variable is not abstract.
and static variable cannot be initialized in an enum constructor
No Any Option.!!!! Answer : enum Course { JAVA(100), J2ME(150); private int cost; private Course(int cost) { this.cost = cost; } int getCost() { return cost; } }
D is the correct answer
D is answer.
Answer is D