CJCoding With Joseph
15free / daySign inCreate account

Tool is an abstract class, so new Tool(...) is not allowed, but it still has constructors, and one of them runs every time a subclass object is built. Complete Hammer, which extends Tool.

Requirements: 1. The Hammer constructor passes name up to the Tool constructor that takes a name. If the call is left out, Java runs the no-argument Tool constructor and the tool is called Unnamed tool. 2. use() returns the tool's name followed by the words drives a nail, for example Old hammer drives a nail. The name field is private in Tool, so read it with getName().

Do not change the Tool class.

Do NOT write a main method.

Expected output

Claw hammer
Claw hammer drives a nail

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

Hints2 available
Topics
Abstract ClassesClasses
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.