欢迎来到求知题库网 求知题库官网
logo
全部科目 > Java认证考试 > SCJP程序员认证考试

单项选择题

1. class A { 
2. public byte getNumber ()  { 
3.   return 1; 
4.   } 
5. } 
6.   
7. class B extends A { 
8. public short getNumber()  { 
9.  return 2; 
10. } 
11.   
12. public static void main (String args[]) {  
13.    B  b = new B (); 
14.      System.out.printIn(b.getNumber())    
15.   } 
16. }   
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.

点击查看答案&解析

相关考题

微信小程序免费搜题
微信扫一扫,加关注免费搜题

微信扫一扫,加关注免费搜题

微信扫一扫,加关注免费搜题

微信扫一扫,加关注免费搜题