Practice · 2 of 2
Interface-driven notifications
CHALLENGE
Difficulty: beginner+25 XP
Inside Solution, write interface Notifier { String send(String msg); } plus two implementations: static class EmailNotifier implements Notifier returns "EMAIL: " + msg, and static class SmsNotifier returns "SMS: " + msg. Implement static String broadcast(Notifier n, String msg) that dispatches through the interface.
Press Submit to check your solution.
Back to lesson: Practice: Practice: Designing with Polymorphism