← Quiz: Object Initialization Order: all 10 questions
Quiz: Object Initialization Order · Question 9 of 10
Why is calling an overridable method from a constructor risky?
Why is calling an overridable method from a constructor risky?
- A.It causes a compile error
- B.The subclass version may run before the subclass's fields are initialised
- C.Overridden methods cannot be called from constructors
- D.It makes the object immutable
Answer & explanation
Correct answer: The subclass version may run before the subclass's fields are initialised
The child's field initialisers run only after the parent constructor finishes.
Can you get the rest right without peeking?
Take the timed Quiz: Object Initialization Order quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →