← Back to Classes
Question 191
Extend a Dog from Animal
Extend a Dog from Animal
A base classAnimalis provided with anamefield and aspeak()method that returns"...". Complete theDogclass so it extendsAnimal. Requirements: 1. Call the parent constructor with the given name usingsuper(). 2. Overridespeak()to return"Woof". Do NOT write a main method. Your class will be tested by a hidden Main class.
Expected Output:
Buddy Woof
= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
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.