public class PrivateOverride{
private void f(){
System.out.printf("Private f()");
}
public static void main(String args[]){
PrivateOverride po = new Derived();
po.f();
}
}
class Derived extends PrivateOverride{
public void f(){
System.out.printf("Public f()");
}
}
输出结果是:
private f()
牧羊人nacy
相关分类