Examveda

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

Answer: Option A


This Question Belongs to Java Program >> Data Types And Variables

Join The Discussion

Related Questions on Data Types and Variables