Home » JAVA Programming » Basic Datatypes » Question
  1. What will ordinal() method provide?

    enum Season {
    WINTER, SPRING, SUMMER, FALL
    };
    System.out.println(Season.WINTER.ordinal());
    1. 1
    2. 0
    3. 3
    4. 2
    5. -1
Correct Option: B

ordinal() method provides number to the variables defined in Enum.



Your comments will be displayed only after manual approval.