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) 说明: 不能重写Final方法。查看编译器错误 在这里 . 这个问题的小测验
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END