A

Admin • 34.80K Points
Instructor I

Q. What is the output of this program?

Code:
enum Color {
        Bleu, Rouge, Vert, Blanc
};

System.out.println(Color.Bleu.ordinal());
  • (A) 0
  • (B) 1
  • (C) 2
  • (D) 3

Explanation by: Admin
The ordinal() method allows you to find the sequence number of an element defined in Enum.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.