乐器



//Instrument类
package d922;

public class Instrument {
public void play()
{
System.out.println("弹奏乐器");
}

}
//Wind类
package d922;

public class Wind extends Instrument {
public void play()
{
System.out.println("弹奏Wind");
}
public void play2()
{
System.out.println("调用Wind的play2");
}

}
//Brass类

package d922;

public class Brass extends Instrument {
public void play()
{
System.out.println("弹奏Brass");
}
public void play2()
{
System.out.println("调用Brass的play2");
}

}
//主类
package d922;

public class Brass extends Instrument {
public void play()
{
System.out.println("弹奏Brass");
}
public void play2()
{
System.out.println("调用Brass的play2");
}

}
//运行结果
弹奏Wind
弹奏Brass

posted @ 2016-09-22 17:47  削肾客  阅读(179)  评论(0编辑  收藏  举报