LearnFrenzy
Sign in Take a free test

Encapsulation · Encapsulation MCQ · Question 20

Records and encapsulation Answer, explanation & discussion

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

What does record Point(int x, int y) {} generate?

  • A Public mutable fields
  • B Private final fields, a constructor, accessors x() and y(), equals, hashCode and toString Correct
  • C Getters and setters
  • D Only a constructor
Correct Answer: Option B

Records are encapsulated, immutable data carriers.

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