// Doesn’t care about type, so new types // added to the system still work right: public static void tune(Instrument i) { // ... i.play(Note.MIDDLE_C); }
public void perform() throws PerformanceException { System.out.print("Playing " + song + " : "); instrument.play(); }
public void perform() throws PerformanceException { for (Instrument instrument : instruments) { instrument.play(); } }