ImageVerifierCode 换一换
格式:DOC , 页数:63 ,大小:180.50KB ,
资源ID:3534722      下载积分:20 文钱
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,省得不是一点点
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.wenke99.com/d-3534722.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: QQ登录   微博登录 

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(scjp题目.doc)为本站会员(sk****8)主动上传,文客久久仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知文客久久(发送邮件至hr@wenke99.com或直接QQ联系客服),我们立即给予删除!

scjp题目.doc

1、scjp 题目与详细解答(1) 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.) /接口中的修饰符只能是 public,static,finalA. final B. static C. native D. public E. private F. abstract G. protected Answer: ABD Question 2 Give

2、n: 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); foreach是个错误的关键词B. for(int z : x) System.out.println(z); C. while(

3、 x.hasNext() System.out.println( x.next(); 对于可变长参数(数组不能调用 hasNext()方法)D. for( int i=0; i F. class Man private BestFriend Answer: D Question 10 Given: 11. public class Person 12. private name; 13. public Person(String name) 14. this.name = name; 15. 16. public int hashCode() 17. return 420; 18. 19. W

4、hich is true? A. The time to find the value from HashMap with a Person key depends on the size of the map. B. Deleting(删除) a Person key from a HashMap will delete all map entries(条目) for all keys of type Person. C. Inserting a second Person object into a HashSet will cause the first Person object to

5、 be removed(覆盖) as a duplicate(复制品). D. The time to determine(决定) whether a Person object is contained(包含)in a HashSet is constant(不变的,持续的) and does NOT depend on the size of the map. Answer: A Question 11 Given: 23. Object myObjects = 24. new integer(12), 25. new String(”foo”), 26. new integer(5),

6、27. new Boolean(true) 28. ; 29. Arrays.sort(myObjects); 30. for( int i=0; imyObjects.length; i+) 31. System.out.print(myObjectsi.toString(); 32. System.out.print(” “); 33. What is the result? A. Compilation fails due(由于) to an error in line 23. B. Compilation fails due to an error in line 29. C. A C

7、lassCastException occurs in line 29. 数组中的所有元素都必须是可相互比较的,String 和 Boolean与 Integer是没有可比性的。D. A ClassCastException occurs in line 31. E. The value of all four objects prints in natural order. (自然顺序)Answer: C Question 12 12. Given: 13. public class Pass 14. public static void main(String 1 args) 15. in

8、t x= 5; 16. Pass p = new Pass(); 17. p.doStuff(x); 18. System.out.print(” main x = “+ x); 19. 20. 21. void doStuff(int x) 22. System.out.print(” doStuff x = “+ x+); 23. 24. What is the result? A. Compilation fails. B. An exception is thrown at runtime. C. doStuffx = 6 main x = 6 D. doStuffx = 5 main

9、 x = 5 E. doStuffx = 5 main x = 6 F. doStuffx = 6 main x = 5 Answer: D Question 13 Given: 10. package com.sun.scjp; 11. public class Geodetics 12. public static final double DIAMETER = 12756.32; / kilometers 13. Which two correctly access the DIAMETER member of the Geodetics class? (Choose two.) A.

10、import com.sun.scjp.Geodetics; public class TerraCarta public double halfway() return Geodetics.DIAMETER/2.0; 静态成员可以用类名直接调用B. import static com.sun.scjp.Geodetics; public class TerraCarta public double halfway() return DIAMETER/2.0; C. import static com.sun.scjp.Geodetics. *; 静态导入,调用时省略类名,.0 新特性publ

11、ic class TerraCarta public double halfway() return DIAMETER/2.0; D. package com.sun.scjp; public class TerraCarta public double halfway() return DIAMETER/2.0; Answer: AC Question 14 Given: 枚举可以声明在类外或类内,在类内定义的枚举,引用时需要通过所在类名来引用10. class Nav 11. public enum Direction NORTH, SOUTH, EAST, WEST 12. 13. pu

12、blic class Sprite 14. / insert code here 15. Which code, inserted at line 14, allows the Sprite class to compile? A. Direction d = NORTH; B. Nav.Direction d = NORTH; C. Direction d = Direction.NORTH; 此项若想通过,必须导入import Nav.*;D. Nav.Direction d = Nav.Direction.NORTH; Answer: D Question 15 Given: 10. i

13、nterface Foo int bar(); 11. public class Sprite 12. public int fubar( Foo foo) return foo.bar(); 13. public void testFoo() 14. fubar( 匿名内部类15. / insert code here 16.); 17. 18. Which code, inserted at line 15, allows the class Sprite to compile? A. Foo public int bar() return 1; B. new Foo public int

14、 bar() return 1; C. new Foo() public int bar()return 1; D. new class Foo public int bar() return 1; Answer: C Question 16 Click the Exhibit button. 10. interface Foo 11. int bar(); 12. 13. 14. public class Beta 15. 16. class A implements Foo 成员内部类17. public int bar() return 1; 18. 19. 20. public int

15、 fubar( Foo foo) return foo.bar(); 21. 22. public void testFoo() 23. 24. class A implements Foo 局部内部类,有局部类时,局部类优先25. public int bar() return 2; 26. 27. 28. System.out.println( fubar( new A(); 29. 30. 31. public static void main( String argv) 32. new Beta().testFoo(); 33. 34. Which three statements a

16、re true? (Choose three.) A. Compilation fails. B. The code compiles and the output is 2. C. If lines 16, 17 and 18 were removed, compilation would fail. D. If lines 24, 25 and 26 were removed, compilation would fail. E. If lines 16, 17 and 18 were removed, the code would compile and the output would

17、 be 2. F. If lines 24, 25 and 26 were removed, the code would compile and the output would be 1. Answer: BEF Question 17 Given: 1. package sun.scjp; 2. public enum Color RED, GREEN, BLUE 1. package sun.beta; 2. / insert code here 3. public class Beta 4. Color g = GREEN; Color 要用 import sun.scjp.Colo

18、r; 导入 ,GREEN要用 import sun.scjp.Color.*或 import static sun.scjp.Color.GREEN;导入5. public static void main( String argv) 6. System.out.println( GREEN); 7. The class Beta and the enum Color are in different packages. Which two code fragments(片段), inserted individually(个别的) at line 2 of the Beta declaration, will allow this code to compile? (Choose two.) A. import sun.scjp.Color.*; B. import static sun.scjp.Color.*; C. import sun.scjp.Color; import static sun.scjp.Color.*;

Copyright © 2018-2021 Wenke99.com All rights reserved

工信部备案号浙ICP备20026746号-2  

公安局备案号:浙公网安备33038302330469号

本站为C2C交文档易平台,即用户上传的文档直接卖给下载用户,本站只是网络服务中间平台,所有原创文档下载所得归上传人所有,若您发现上传作品侵犯了您的权利,请立刻联系网站客服并提供证据,平台将在3个工作日内予以改正。