AP CSA Unit 3 Day 25: Super Call
Share
Unit 3, Classes & Objects • Cycle 2
Day 25 Advanced Practice • Harder Difficulty
Focus: super() Call
Hard
super() Call
Advanced Practice Question
Format: super() Call
What is the output?
What is the output?
public class X {
public X(int n) {
System.out.print("X" + n);
}
}
public class Y extends X {
public Y() {
super(5);
System.out.print("Y");
}
}
// In another class:
Y obj = new Y();
Difficulty: Hard |
Topic: super() Call |
Cycle: 2 (Advanced)
Why This Answer?
super(5) explicitly calls parent's constructor with argument 5, printing X5. Then subclass constructor continues and prints Y.
Common Mistake
Watch Out!
Forgetting that super() must be the first statement in a subclass constructor.
AP Exam Strategy
super(...) explicitly calls a parent constructor and must be first line if used.
Master This Topic
This Cycle 2 HARD question tests super() call. Review Unit 3 concepts to build mastery of classes & objects.
- Understanding super() call
- 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