Interfaces and polymorphism

What string does this implementation return?

Examples

Worked example

Input
Formatter f = name -> "Hi " + name; f.format("Mira")
Expected output
Hi Mira

Hints and solution

Hint 1

Write down the starting state and walk through one example by hand.

Reveal worked answer

The selected formatter adds its prefix to the supplied name.

Back to the lesson