black

SCJP程序员认证考试

登录

单项选择题

11. class Cup { } 
12. class PoisonCup extends Cup { } 
21. public void takeCup(Cup c) { 
22. if(c instanceof PoisonCup) { 
23. System.out.println(”Inconceivable!”); 
24. } else if(c instanceof Cup) { 
25. System.out.println(”Dizzying intellect!”); 
26. } else { 
27. System.exit(0); 
28. } 
29. } 
And the execution of the statements: 
Cup cup = new PoisonCup();
takeCup(cup); 
What is the output?() 

A. Inconceivable!
B. Dizzying intellect!
C. The code runs with no output.
D. An exception is thrown at runtime.
E. Compilation fails because of an error in line 22.

相关考题

多项选择题 10. public class MyClass {  11.  12. public Integer startingI;  13. public void methodA() {  14. Integer i = new Integer(25);  15. startingI = i;  16. methodB(i);  17. }  18. private void methodB(Integer i2) {  19. i2 = i2.intValue();  20.  21. }  22. }  If methodA is invoked, which two are true at line 20?()

单项选择题 public static void test(String str) { int check = 4;  if (check = str.length()) {  System.out.print(str.charAt(check -= 1) +“, “);  } else {  System.out.print(str.charAt(0) + “, “);  }  }  and the invocation:  test(”four”);  test(”tee”); test(”to”);  What is the result?()

单项选择题 11. public static void test(String str) {  12. if(str == null | str.lellgth() == 0) {  13. System.out.println(”String is empty”);  14. } else {  15. System.out.println(”String is not empty”);  16. }  17. }  And the invocation:  31. test(llull);  What is the result?()

All Rights Reserved 版权所有©考试题库网(kstiku.com)

备案号:湘ICP备14005140号-3

经营许可证号:湘B2-20140064