Skip to content
Sharp

Modern Java · interview question

In the context of enums, what advantage does adding methods to an enum provide?

Multiple choiceMediumchapter-7-curatedpremiummodern-javaenums
Choose one answer
Answer and explanation

Correct answer

B. Enhances enum functionality by associating behavior with constants

Why

Adding methods to an enum allows you to associate specific behavior with each constant, enhancing the functionality and making the code more expressive and maintainable.

Test yourself on Modern Java

A free test with instant, explained results. No account needed.

Start free test
All Modern Java questions →