1Z0-829 Utilizing Java Object-Oriented Approach Practice Question
Given a record `Point(int x, int y)`, which statement is true about the automatically generated constructor?
⚠ Common exam trap
Test-takers frequently think the compact constructor replaces the canonical constructor entirely, not realizing it still performs the implicit assignments, or they may confuse the compact constructor with a no-arg constructor or assume records have default constructors like regular classes.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
You can define a compact constructor that modifies the parameters before assignment.
In Java records, you can define a compact constructor that omits the parameter list and allows you to modify the implicit parameters before they are assigned to the components. This is the only customization allowed for the canonical constructor; the compact constructor implicitly assigns the (possibly modified) parameters to the components at the end of its body.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
You can define a compact constructor that modifies the parameters before assignment.
Why this is correct
A compact constructor can perform validation or modification.
- ✗
You can define a no-arg constructor by default.
Why it's wrong here
Records have a canonical constructor based on all components; no no-arg constructor by default.
- ✗
The generated constructor is package-private.
Why it's wrong here
The canonical constructor has the same access as the record itself, which is public.
- ✗
The generated constructor throws `NullPointerException` for any null component.
Why it's wrong here
Records do not automatically throw NPE for null components unless explicitly coded.
Go deeper
Related to this question
About these practice questions
This 1Z0-829 question is part of Courseiva's 513-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 1Z0-829 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-829 exam.