Recall & Review
beginner
What is a constructor in Java?
A constructor is a special method in Java used to create and initialize objects. It has the same name as the class and no return type.Click to reveal answer
beginner
What happens first when a Java object is created?
The superclass constructor is called first before the subclass constructor runs. This ensures the parent part of the object is initialized first.Click to reveal answer
intermediate
How does Java decide which constructor to call in a class hierarchy?Java calls constructors starting from the top superclass down to the subclass. Each constructor calls its superclass constructor using super(), either explicitly or implicitly.Click to reveal answer
intermediate
What is the role of the super() call in constructor execution?
super() calls the parent class constructor. If not written explicitly, Java inserts super() automatically as the first line in a constructor.Click to reveal answer
advanced
In what order are instance variables initialized during constructor execution?
Instance variables are initialized first in the order they appear, then the constructor body runs. This happens for each class from superclass to subclass.Click to reveal answer
When creating an object, which constructor runs first?
✗ Incorrect
The superclass constructor runs first to initialize the parent part of the object.
What does Java insert automatically if a constructor does not call super() explicitly?
✗ Incorrect
Java inserts super() automatically as the first statement to call the parent constructor.
Which of these is true about instance variable initialization during constructor execution?
✗ Incorrect
Instance variables are initialized first, then the constructor body executes.
If a subclass constructor calls super(), what does it do?
✗ Incorrect
super() calls the constructor of the immediate parent class.
What is the order of constructor execution in a class hierarchy?
✗ Incorrect
Constructors run from the top superclass down to the subclass.
Explain the flow of constructor execution when creating an object in Java.
Think about how Java builds an object from parent to child.
You got /4 concepts.
Describe what happens if you do not explicitly call super() in a subclass constructor.
Remember Java's default behavior for constructor chaining.
You got /3 concepts.