← All topics
Quiz: Object Initialization Order: questions with answers
10 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. What does this print? (code)
- Q2. When does a class's static block run?
- Q3. A class has a field initialiser and an instance block. Which runs first?
- Q4. What does this print? (code)
- Q5. Parent Person has only the constructor Person(String name). What happens with class Student extends Person { Student() { } }?
- Q6. Where must this(...) or super(...) appear inside a constructor?
- Q7. What does this print? (code)
- Q8. For new Child() where Child extends Parent (both used for the first time), what runs first?
- Q9. Why is calling an overridable method from a constructor risky?
- Q10. Which kind of method is safe to call from a constructor?