black

SCJP程序员认证考试

登录

单项选择题

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.

相关考题

多项选择题 1. class BaseClass {  2. private float x = 1.of;  3. protected float getVar() { return x; }  4. }  5. class SubClass extends BaseClass {  6. private float x = 2.Of;  7. // insert code here 8. }   Which two are valid examples of method overriding when inserted at line 7?()

多项选择题 Whichthreedemonstratean“isa”relationship?()

单项选择题 try {  if ((new Object))(.equals((new Object()))) {  System.out.println(“equal”);  }else{  System.out.println(“not equal”);  }  }catch (Exception e) {  System.out.println(“exception”);  }   What is the result? ()

All Rights Reserved 版权所有©求知题库网库(csqiuzhi.com)

备案号:湘ICP备14005140号-1

经营许可证号:湘B2-20140064