CJCoding With Joseph
15free / daySign inCreate account

In this question the public type of the file is the interface Greeter itself. It has one abstract method, name(), and one default method, greet(). A default method has a body inside the interface, so every class that implements Greeter gets greet() without writing it. Complete the body of greet().

Requirements: 1. greet() returns the word Hello, a comma, one space, and then the text that name() returns. For the name Ravi it returns Hello, Ravi. 2. Call the abstract method name() to get the text. Each implementing class supplies its own name(). 3. Keep the default keyword and the method header as they are.

The tests bring their own classes that implement Greeter and write only name().

Do NOT write a main method.

Expected output

Hello, Maya
Hello, Unit 7

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

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