A

Admin • 828.70K Points
Coach

Q. What will be the output of the following Java code snippet?
enum Enums
{
A, B, C;

private Enums()
{
System.out.println(10);
}
}

public class MainClass
{
public static void main(String[] args)
{
Enum en = Enums.B;
}
}

  • (A) 10 10 10
  • (B) Compilation Error
  • (C) 10 10
  • (D) Runtime Exception
  • Correct Answer - Option(A)
  • Views: 10
  • Filed under category Java
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.