📜  Java |继承|问题2

📅  最后修改于: 2021-06-28 22:31:59             🧑  作者: Mango

class Base {
    final public void show() {
       System.out.println("Base::show() called");
    }
}
   
class Derived extends Base {
    public 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)编译器错误
(D)运行时错误答案: (C)
说明:最终方法不能被覆盖。请在此处查看编译器错误。
这个问题的测验