输出为“ Hey from A”。您能解释一下为什么不是“ B嗨”吗?
public class A {
private void print() {
System.out.println("Hey from A");
}
public void getInfo() {
print();
}
}
public class B extends A {
public void print() {
System.out.println("Hey from B");
}
public static void main(String args[]) {
B b= new B();
b.getInfo();
}
}