← Quiz: Object Initialization Order: all 10 questions
Quiz: Object Initialization Order · Question 3 of 10
A class has a field initialiser and an instance block. Which runs first?
A class has a field initialiser and an instance block. Which runs first?
- A.Always the field initialiser
- B.Always the instance block
- C.The constructor body
- D.Whichever appears first in the source code
Answer & explanation
Correct answer: Whichever appears first in the source code
Field initialisers and instance blocks run top to bottom, before the constructor body.
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 →