package ty; abstract class A { public abstract void fun(); };
package ty; class B extends A { public void fun() { System.out.println("what is your name?"); } };
package ty; public class AandB { public static void main(String[] args) { B b=new B(); b.fun(); } }
package sy; abstract class A { private String name; public A(String name) { this.name=name; } public String getName() { return this.name; } public abstract void fun(); };
package sy; class B extends A{ public B(String name) { super(name); } public void fun() { System.out.println(super.getName()); } };
package sy; public class Adm { public static void main(String args[]) { B b = new B("大黄"); b.fun(); } };
package sy; public abstract class C { private String name; public C(String name) { this.name=name; } public String getName() { return this.name; } public abstract void fun(); }
package sy; public class D extends C { public D(String name) { super(name); } public void fun() { System.out.println(super.getName()); } }
package sy; public class CandD { public static void main(String[] args) { B b =new B("八戒"); b.fun(); } }