Java: Which statement about Encapsulation is the strongest interview answer?

Difficulty:

Easy

Questions:

1

Time Limit:

2 minutes

Passing Score:

100%

Question

Which statement about Encapsulation is the strongest interview answer?

  1. Encapsulation is mostly a naming style choice and has little effect on runtime or design.
  2. Encapsulation exists mainly to reduce the number of Java files in a project.
  3. Encapsulation protects invariants by controlling how internal state is read and modified.
  4. Encapsulation matters only for frontend frameworks, not for core Java applications.

Hint

Start with the core rule behind Encapsulation.

Answer and rationale

Correct answer: C. Encapsulation protects invariants by controlling how internal state is read and modified.

Encapsulation protects invariants by controlling how internal state is read and modified. This is the base concept interviewers commonly test first.

Track: Java