Which method returns the position of an enum constant in its declaration?

  1. ordinal()
  2. position()
  3. index()
  4. value()
Correct answer ordinal()

Explanation

The `ordinal()` method returns the zero-based position of the enum constant in the enum declaration.

Update: Admin added a tag on this question

Topics

By Admin · · 40 views