Question
What deeper point about Encapsulation should a senior Java developer mention?
- At senior level, the right answer is that Encapsulation exists mostly for historical syntax reasons.
- At senior level, the JVM removes the tradeoffs around Encapsulation, so design choices barely matter.
- Encapsulation shrinks the bug surface because fewer call sites can push an object into an invalid or inconsistent state.
- At senior level, any approach to Encapsulation is equally correct if it compiles and passes a small test.
Hint
Look beyond syntax and explain the runtime, API, or design consequence.
Answer and rationale
Correct answer: C. Encapsulation shrinks the bug surface because fewer call sites can push an object into an invalid or inconsistent state.
Encapsulation shrinks the bug surface because fewer call sites can push an object into an invalid or inconsistent state. This is the kind of tradeoff-aware answer senior interviews usually expect.
Track: Java