determine the behavior of this program:.
public class Main { Letter l;/*from w w w . j a va 2 s .c om*/ enum Letter {A, B, C}; public Main(Letter pType) { l = pType; } public static void main(String[] args) { Letter pType = new Letter(); Main enumTest = new Main(Letter.C); } }
A. prints the output printertype:laser B. Compiler error: enums must be declared static C. Compiler error: cannot instantiate the type enumtest.printertype D. this program will compile fine, and when run, will crash and throw a runtime exception
C.
You cannot instantiate an enum type using new.