网站大量收购独家精品文档,联系QQ:2885784924

《【IT书籍】java认证之SCJP考试试题及答案讲解》.doc

《【IT书籍】java认证之SCJP考试试题及答案讲解》.doc

  1. 1、本文档共58页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
《【IT书籍】java认证之SCJP考试试题及答案讲解》.doc

Question 1 Given: 11. public interface Status { 12. /* insert code here */ int MY_VALUE = 10; 13. } Which three are valid on line 12? (Choose three.) A. final B. static C. native D. public E. private F. abstract G. protected A B D Question 2 Given: 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? (Choose two.) A. foreach(x) System.out.println(z); B. for(int z : x) System.out.println(z); C. while( x.hasNext()) System.out.println( x.next()); D. for( int i=0; i x.length; i++ ) System.out.println(x[i]); B D Question 3 Given: 11. public class Test { 12. public static void main(String [] args) { 13. int x = 5; 14. boolean b1 = true; 15. boolean b2 = false; 16. 17.if((x==4) !b2) 18. System.out.print(l ); 19. System.out.print(2 ); 20. if ((b2 = true) b1) 21. System.out.print(3 ); 22. } 23. } What is the result? A. 2 B. 3 C. 1 2 D. 2 3 E. 1 2 3 F. Compilation fails. G. Au exceptional is thrown at runtime. D Question 4 Given: 11. String[] elements = { for, tea, too }; 12. String first = (elements.length 0)? elements[0] : null; What is the result? A. Compilation fails. B. An exception is thrown at runtime. C. The variable first is set to null. D. The variable first is set to elements[0]. D Question 5 Given: 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; beta不能转换为delta C. Foo f= (Alpha)x; D. Beta b = (Beta)(Alpha)x; B Question 6 Given: 11. class Cup { } 12. class PoisonCup extends Cup { } 21. public void takeCup(Cup c) { 22. if(c instanceof PoisonCup) { 23. System.out.println(Inconc

文档评论(0)

mwap + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档