Can enum constants have their own method implementations?

  1. No, all methods are shared
  2. Yes, using anonymous class bodies per constant
  3. Only static methods can be overridden
  4. Only if the enum is final
Correct answer Yes, using anonymous class bodies per constant

Explanation

Enum constants can override methods individually by providing anonymous class implementations.

Update: Admin added a tag on this question

Topics

By Admin · · 32 views