โ 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
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.