Question 18
Back to Exercise
Why might a constructor call the class's own (final or private) validating setters?
- A Constructors cannot assign fields
- B To reuse the same validation, so objects are valid from the start Correct
- C For speed
- D To make the fields public
Correct Answer: Option B
Keep such setters final so subclasses cannot change them during construction.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!