โ Back to Inheritance
Question 525
Constructor Chain Trace
Constructor Chain Trace
Constructors run from the top of the hierarchy down.A's constructor printsA constructor. CreateB : Awhose constructor printsB constructor, andC : Bwhose constructor printsC constructor. Because base constructors run first, creating aCprints all three lines top-down. Do NOT write aMainmethod. When the tester creates aC, the program prints: A constructor B constructor C constructor
Expected Output:
A constructor B constructor C constructor
Topics:
Inheritance
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.