class A { public byte getNumber() { return 1; } } class B extends A { public short getNumber() { return 2; } public static void main(String args[]) { B b = new B(); System.out.println(b.getNumber()); } } What is the result?()
- A、 1
- B、 2
- C、 An exception is thrown at runtime.
- D、 Compilation fails because of an error in line 8.
- E、 Compilation fails because of an error in line 14.
正确答案:D
答案解析:有
微信扫一扫手机做题