AP CSA Unit 3 Day 9: Inheritance Constructor Calls
Share
Unit 3, Classes & Objects • Cycle 2
Day 9 Advanced Practice • Harder Difficulty
Focus: Inheritance Constructor Calls
Hard
Inheritance Constructor Calls
Advanced Practice Question
Format: Inheritance Constructor Calls
What is the output?
What is the output?
public class Base {
public Base() {
System.out.print("X");
}
}
public class Derived extends Base {
public Derived() {
System.out.print("Y");
}
}
// In another class:
Derived d = new Derived();
Difficulty: Hard |
Topic: Inheritance Constructor Calls |
Cycle: 2 (Advanced)
Why This Answer?
The subclass constructor automatically calls super() FIRST (even if not written explicitly), which prints X. Then the subclass constructor body prints Y.
Common Mistake
Watch Out!
Thinking the subclass constructor runs before the superclass constructor.
AP Exam Strategy
Constructors execute superclass first, then subclass (inside-out construction).
Master This Topic
This Cycle 2 HARD question tests inheritance constructor calls. Review Unit 3 concepts to build mastery of classes & objects.
- Understanding inheritance constructor calls
- Tracing code execution accurately
- Avoiding common pitfalls
Ready for More Challenges?
Cycle 2 questions prepare you for the hardest AP CSA exam questions.
Study Games Practice FRQs