What will be the output of the following code?
public enum IceCream {
... VANILLA ("white"),
STRAWBERRY ("pink"),
WALNUT ("brown"),
CHOCOLATE ("dark brown");
String color;
IceCream (String color) {
this.color = color;
}
public static void main (String[] args) {
System.out.println (VANILLA);
System.out.println (CHOCOLATE);
}
}
Options:
A. Compilation error : Cannot run an enum as a standalone application.
B. Compilation error at line no 14 & 15 : Cannot access VANILLA and CHOLOCLATE in 'static' main method.
C. No errors. Output:
VANILLA
CHOCOLATE
D. No errors. Output:
white
dark brownSee More
Source: http://www.facebook.com/Oracle/posts/121083588036348
the quiet man yellow cab dropkick murphys guernsey nit colcannon dystonia
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.