多做题,通过考试没问题!

Java认证考试

睦霖题库>其他计算机考试>Java认证考试

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.
正确答案:A
答案解析:
进入题库查看解析

微信扫一扫手机做题