← Back to Inheritance
Question 615
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 the output shown in Expected Output.
Expected Output:
A constructor B constructor C constructor
= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
Inheritance
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · 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.