//Monkey类
package d922;
public class Monkey {
Monkey()
{
}
Monkey (String s)
{
System.out.println(s);
}
public void speak()
{
System.out.println("咿呀");
}
}
//人类
package d922;
public class Mankind extends Monkey {
public void speak()
{
System.out.println("小样的,不错嘛!会说话了!");
}
public void think()
{
System.out.println("别说话!认真思考!");
}
}
///主类
package d922;
public class TestE {
public static void main(String[] args) {
Monkey m=new Monkey("Janpanese");
m.speak();
Mankind n=new Mankind();
n.speak();
}
}
//运行结果
Janpanese
咿呀
小样的,不错嘛!会说话了!