11c 11.13
阿新 • • 發佈:2017-11-14
system main print color http return pri static ()
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(); } }
11c 11.13