观察以下代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | class Car extends Vehicle { public static void main (String[] args) { new Car(). run(); } private final void run() { System. out. println ("Car"); } } class Vehicle { private final void run() { System. out. println("Vehicle"); } } |
下列哪些针对代码运行结果的描述是正确的?
正确答案: A 你的答案: D
(错误)
Car
Vehicle
Compiler error at line 3
Compiler error at line 5
Exception thrown at runtime
原因是父类中的方法是私有的,子类不会继承,所以运行的时候也是使