Skip to content
Sharp

Modern Java · interview question

Which of the following best describes how enums enhance code readability?

Multiple choiceMediumchapter-7-curatedpremiummodern-javamodern-java-design-choices
Choose one answer
Answer and explanation

Correct answer

A. Enums provide descriptive names for constant values

Why

Enums provide meaningful names for constant values, improving code readability and reducing the risk of errors. They make the intent of the code clearer as opposed to using arbitrary string or numeric constants.

Test yourself on Modern Java

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

Start free test
All Modern Java questions →