What type of method is `values()` in an enum?

  1. Static method added by compiler
  2. Instance method
  3. Method from Enum class
  4. Custom method defined by user
Correct answer Static method added by compiler

Explanation

`values()` is a static method automatically added by the compiler.

Update: Dhruva Jagannath added a tag on this question

Topics

By Dhruva Jagannath · · 33 views