Esempio n. 1
0
 // 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();
 }
Esempio n. 3
0
 public void perform() throws PerformanceException {
   for (Instrument instrument : instruments) {
     instrument.play();
   }
 }