Skip to content
Sharp

Core Java · interview question

Why can using too many setters in a class become a problem in practice?

Multiple choiceMediumchapter-3-curatedpremiumcore-javacode-reading-and-state-safety
Choose one answer
Answer and explanation

Correct answer

A. Increased risk of inconsistent state

Why

Too many setters allow frequent state changes, which can lead to an inconsistent state if invariants are not properly checked, reducing the safety of the object's design.

Test yourself on Core Java

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

Start free test
All Core Java questions →