LearnFrenzy
Sign in Take a free test

Records, Enums and Sealed Classes · Records, Enums and Sealed Classes MCQ · Question 12

The compact constructor Answer, explanation & discussion

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

What is a compact constructor in a record used for?

  • A Creating a copy of the record
  • B Validating or normalising the component values before they are assigned to the fields Correct
  • C Adding extra fields
  • D Making the record mutable
Correct Answer: Option B

It has no parameter list; the fields are assigned automatically at the end.

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