public class Test4 { public static void main(String[] args){ Instrument ss[]={new Wind(),new Piano()}; for(Instrument i:ss){ tun(i); } } public static void tun(Instrument i){ i.play(); } } interface Instrument{ void play(); } class Wind implements Instrument{ public void play(){ System.out.println("wind can play"); } } class Piano implements Instrument{ public void play(){ System.out.println("Piano can play"); } }