abstract class A{
public A(){
System.out.println("父类-->A") ;
}
public abstract void fun();
};
class B extends A{
public B(){
System.out.println("子类-->B") ;
}
public void fun(){
System.out.println("覆写了父类的fun()方法") ;
}
}
public class print {
public static void main(String args[]){
B b = new B() ;
b.fun() ;
}
} |
|