โ Back to Polymorphism
Question 552
Two Overloaded Print Methods
Two Overloaded Print Methods
ThePrinterclass already has aPrint(int)method. Add a secondstringso the same method name works for both types. This is method overloading. Do NOT write aMainmethod. The tester callsPrint(7)thenPrint("hi")and the program prints: Int: 7 Text: hi
Expected Output:
Int: 7 Text: hi
Topics:
Polymorphism
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.