CJCoding With Joseph
15free / daySign inCreate account

Inherit and Call Super Method

A Vehicle class is provided with a method describe() that returns "I am a vehicle". Complete the Truck class that extends Vehicle.

Requirements:
1. Override describe() to return the parent's description followed by " - specifically a truck". You must call super.describe() to get the parent's text.

So the final output of describe() should be: "I am a vehicle - specifically a truck".

Do NOT write a main method.

Expected Output:

I am a vehicle - specifically a truck

= newline. The output ends with a newline — print one after the last line.

Hints2 available
Topics:
InheritanceClasses
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · 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.