class Grandparent {
public void say(){
System.out.println("Hello Grandparent");
}
}
class Parent extends Grandparent{
public void say() {
super.say();
}
}
class Child extends Parent
{
public void say()
{
System.out.println("Hello Child");
}
}
public class TestInherits
{
public static void main(String []args)
{
Parent b=new Parent();
Child c = new Child();
b.say();
c.say();
}
}
标签:覆盖,Parent,void,class,say,Child,public From: https://www.cnblogs.com/leapssisbird/p/17760426.html