Skip to content
Sharp

Object-oriented programming · interview question

Which of the following is a characteristic of well-designed fields in a Java class?

Multiple choiceEasychapter-2-curatedpremiumoopfields-and-state
Choose one answer
Answer and explanation

Correct answer

B. They are private and have getters/setters if needed

Why

Well-designed fields are usually private to implement encapsulation, providing controlled access through getters and setters if necessary. This approach helps maintain the integrity of the object's state.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →