java子类复写私有方法问题
我很穷的,没多少积分了,20分问个问题
下面的代码会输出什么?为什么啊??
public class ExtendTest {
public static void main(String[] args) {
new Child().prt();
}
}
class Child extends Father {
public void printF() {
System.out.println("F-Child");
}
public void printM() {
System.out.println("M-Child");
}
}
class Father {
public void printF() {
System.out.println("public:Father");
}
private void printM() {
System.out.println("private:Mother");
}
public void prt() {
printF();
printM();
}
}