📜  Java |继承|问题3

📅  最后修改于: 2021-06-28 17:23:29             🧑  作者: Mango

class Base {
    public static void show() {
       System.out.println("Base::show() called");
    }
}
   
class Derived extends Base {
    public static void show() {
       System.out.println("Derived::show() called");
    }
}
   
class Main {
    public static void main(String[] args) {
        Base b = new Derived();;
        b.show();
    }
}

(A )调用Base :: show()
(B)派生:: show()被调用
(C)编译器错误答案: (A)
说明:与C++一样,当函数为静态时,不会发生运行时多态。
这个问题的测验