Given this enum declaration:
Examine this code:
System.out.println(Alphabet.getFirstLetter());
What code should be written at line 3 to make this code print A?
Given this enum declaration:
Examine this code:
System.out.println(Alphabet.getFirstLetter());
What code should be written at line 3 to make this code print A?
The method getFirstLetter should be static to be called without an instance of the enum. Also, using A.toString() will return the string representation of the constant A, which is what should be printed. Thus, the correct code at line 3 is: static String getFirstLetter() { return A.toString(); }.
C is true