LearnFrenzy
Sign in Take a free test

Encapsulation · Encapsulation MCQ · Question 15

Why setStatus() is risky Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 15 Back to Exercise

Why is a public setStatus(String) method on an Order risky?

  • A Strings are slow
  • B Callers could jump to any status (e.g. CREATED to DELIVERED), skipping business rules Correct
  • C It cannot be overridden
  • D It must be static
Correct Answer: Option B

Expose actions like pay() and ship() instead.

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!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links