What will be the result of attempting to compile and run the following code?.
public enum Main { C1("c1"), C2("c2"), C3("c3"), C4("c4"); private String c; Main(String c) {// w w w.j a v a 2s. c o m this.c = c; } public static void main(String[] args) { System.out.println(C1); // (1) System.out.println(C4); // (2) } }
Select the one correct answer.
(d)
An enum type can be run as a standalone application.
The constants need not be qualified when referenced inside the enum type declaration.
The constants are static members.
The toString()
method always returns the name of the constant, unless it is overridden.