package cn.ch.w; public abstract class A { public abstract void fun(); }
package cn.ch.w; public class B extends A{ public void fun(){ System.out.println("嗨!你好小蘑菇!!"); } }
package cn.ch.w; public class ABstractDemo { public static void mian(String args[]){ B b=new B(); b.fun(); } }
package cn.ch.w; public abstract class A { private String name; public A(String name){ this.name=name; } public String getnName(){ return this.name; } public abstract void fun(); }
package cn.ch.w; public class B extends A{ public B(String name){ super(name); } public void fun(){ System.out.print(super.getnName()); } }
package cn.ch.w; public class AbstractDemo { public static void main(String[] args) { B b=new B("小蘑菇!!"); b.fun(); } }