问题:
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.printIn(b.getNumber())
}
}
What is the result?()
A . Compilation succeeds and 1 is printed.
B . Compilation succeeds and 2 is printed.
C . An error at line 8 causes compilation to fail.
D . An error at line 14 causes compilation to fail.
E . Compilation succeeds but an exception is thrown at line 14.
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.printIn(b.getNumber())
}
}
What is the result?()
● 参考解析
本题暂无解析