โ Back to Classes
Question 195
Inherit and Call Super Method
Inherit and Call Super Method
AVehicleclass is provided with a methoddescribe()that returns"I am a vehicle". Complete theTruckclass that extendsVehicle. Requirements: 1. Overridedescribe()to return the parent's description followed by" - specifically a truck". You must callsuper.describe()to get the parent's text. So the final output ofdescribe()should be:"I am a vehicle - specifically a truck". Do NOT write a main method.
Expected Output:
I am a vehicle - specifically a truck
Topics:
InheritanceClasses
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (sysout, psvm, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.