Use an Interface as a Parameter Type
easyQuestion 523Performer is an interface with one method, perform(). Singer and Juggler both implement it. An interface is also a type, so a method can accept any object whose class implements it without knowing which class that is. Complete Stage.introduce.
Requirements:
1. introduce(Performer p) returns the text Next up: (with one space after the colon) followed by what p.perform() returns.
2. Do not test which class p is. Call the interface method and let the object answer.
3. The tests also pass performers you have not seen, written in the tests.
4. Do not change Performer, Singer or Juggler.
Do NOT write a main method.
Expected output
Next up: singing Blue Skies Next up: juggling 3 balls
= newline. The output ends with a newline, so print one after the last line.
Hints2 available
Sign in to use hintsTopics
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.