black

SCJP程序员认证考试

登录

单项选择题

10. interface Foo {} 
11. class Alpha implements Foo {} 
12. class Beta extends Alpha {} 
13. class Delta extends Beta { 
14. public static void main( String[] args) { 
15. Beta x = new Beta(); 
16. // insert code here 
17. } 
18. } 
Which code, inserted at line 16, will cause a java.lang.ClassCastException?() 

A. Alpha a = x;
B. Foo f= (Delta)x;
C. Foo f= (Alpha)x;
D. Beta b = (Beta)(Alpha)x;

相关考题

多项选择题 31. // some code here  32. try {  33. // some code here  34. } catch (SomeException se) {  35. // some code here  36. } finally {  37. // some code here  38. }  Under which three circumstances will the code on line 37 be executed?()

单项选择题 public class Test {  public static void main(String [] args) {  int x =5;  boolean b1 = true;  boolean b2 = false;  if((x==4) && !b2)  System.out.print(”l “);  System.out.print(”2 “);  if ((b2 = true) && b1)  System.out.print(”3 “);  } }  What is the result?()

多项选择题 10. public class Bar {  11.static void foo(int...x) {  12. // insert code here  13. }  14. }  Which two code fragments, inserted independently at line 12, will allow the class to compile?()

All Rights Reserved 版权所有©易学考试网(yxkao.com)

备案号:湘ICP备2022003000号-3