package homework; public class Instrument { public void play() { System.out.println("弹奏乐器"); } }
package homework; public class Wind { public void play() { System.out.println("弹奏Wind"); } public void play2() { System.out.println("听,那旋律多美妙"); } }
package homework; public class Brass extends Instrument { public void play() { System.out.println("弹奏Brass"); } public void play2() { System.out.println("听,那节奏感多强烈"); } }
package homework; public class Music { public static void main(String[] args) { Wind w= new Wind(); w.play(); w.play2(); Brass b= new Brass(); b.play(); b.play2(); } }