Which of the following is the correct way to iterate over an enum in Java?
Correct answer
Using a for-each loop on Enum.values()
Explanation
You can use a for-each loop on `Enum.values()` to iterate over all enum constants.
Update: Dhruva Jagannath added a tag on this question
Topics
By Dhruva Jagannath · · 64 views