CJCoding With Joseph
15free / daySign inCreate account

Extend a Dog from Animal

A base class Animal is provided with a name field and a speak() method that returns "...". Complete the Dog class so it extends Animal.

Requirements:
1. Call the parent constructor with the given name using super().
2. Override speak() 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
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.