本文共 353 字,大约阅读时间需要 1 分钟。
public class C {
public void f(){ System.out.printf("CCC\n");}}public class D extends C{public void f() { System.out.printf("DDD\n");}
}
public class Exercise2 {
public static void g(C cc){ cc.f();}public static void main(String[] args) { D dd1=new D(); C cc1=new C(); g(cc1); g(dd1);}
}
转载于:https://blog.51cto.com/13930723/2355866