蚂蚁文库
换一换
首页 蚂蚁文库 > 资源分类 > DOC文档下载
 

35道SCJP考试真题精解

  • 资源ID:50599124       资源大小:66.00KB        全文页数:15页
  • 资源格式: DOC        下载权限:游客/注册会员    下载费用:18积分 【人民币18元】
快捷注册下载 游客一键下载
会员登录下载
三方登录下载: 微信快捷登录 QQ登录  
下载资源需要18积分 【人民币18元】
邮箱/手机:
温馨提示:
支付成功后,系统会自动生成账号(用户名和密码都是您填写的邮箱或者手机号),方便下次登录下载和查询订单;
支付方式: 微信支付    支付宝   
验证码:   换一换

 
友情提示
2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,既可以正常下载了。
3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰   

35道SCJP考试真题精解

35道SCJP考试真题精解 例题1 Choose the three valid identifiers from those listed below. A. IDoLikeTheLongNameClass B. byte C. const D. _ok E. 3_case 解答A, B, D 点评Java中的标示符必需是字母、美元符或下划线_开头。关键字与保留字不能作为标示符。选项C中的const是Java的保留字,所以不能作标示符。选项E中的3_case以数字开头,违反了Java的规则。 例题2 How can you force garbage collection of an object A. Garbage collection cannot be forced B. Call System.gc. C. Call System.gc, passing in a reference to the object to be garbage collected. D. Call Runtime.gc. E. Set all references to the object to new valuesnull, for example. 解答A 点评在Java中垃圾收集是不能被强迫马上执行的。调用System.gc或Runtime.gc静态方法不能保证垃圾收集器的马上执行,因为,或许存在着更高优先级的线程。所以选项B、D不正确。选项C的错误在于,System.gc方法是不接受参数的。选项E中的方法可以使对象在下次垃圾收集器运行时被收集。 例题3 以下是引用片段 Considerthefollowingclass 1.classTestinti{ 2.voidtestinti{ 3.System.out.println“Iamanint.”; 4.} 5.voidtestStrings{ 6.System.out.println“Iamastring.”; 7.} 8. 9.publicstaticvoidmainStringargs[]{ 10.TesttnewTest; 11.charch“y”; 12.t.testch; 13.} 14.} Which of the statements below is trueChoose one. A. Line 5 will not compile, because void s cannot be overridden. B. Line 12 will not compile, because there is no version of test that rakes a char argument. C. The code will compile but will throw an exception at line 12. D. The code will compile and produce the following output I am an int. E. The code will compile and produce the following output I am a String. 解答D 点评在第12行,16位长的char型变量ch在编译时会自动转化为一个32位长的int型,并在运行时传给void testint i方法。 例题4 Which of the following lines of code will compile without error A. 以下是引用片段 inti0; ifi{ System.out.println“Hi”; } B. 以下是引用片段 booleanbtrue; booleanb2true; ifbb2{ System.out.println“Sotrue”; } C. 以下是引用片段 inti1; intj2; ifi1||j2 System.out.println“OK”; D. 以下是引用片段intln“OK”; 解答B, C 点评选项A错,因为if语句后须要一个boolean类型的表达式。逻辑操作有、、| 和 、||,但是“|”是非法的,所以选项D不正确。 例题5 以下是引用片段 WhichtwodemonstrateahasarelationshipChoosetwo A.publicinterfacePerson{} publicclassEmployeeextendsPerson{} B.publicinterfaceShape{} publicinterfaceRectandleextendsShape{} C.publicinterfaceColorable{} publicclassShapeimplementsColorable {} D.publicclassSpecies{} publicclassAnimal{privateSpeciesspecies;} E.interfaceComponent{} classContainerimplementsComponent{ privateComponent[]children; } 解答D, E 点评 在Java中代码重用有两种可能的方式,即组合“has a”关系和继承“is a”关系。“has a”关系是通过定义类的属性的方式实现的;而“is a”关系是通过类继承实现的。本例中选项A、B、C体现了“is a”关系;选项D、E体现了“has a”关系。 例题6 Which two statements are true for the class java.util.TreeSet Choose two A. The elements in the collection are ordered. B. The collection is guaranteed to

注意事项

本文(35道SCJP考试真题精解)为本站会员(15882742095)主动上传,蚂蚁文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知蚂蚁文库(发送邮件至2303240369@qq.com或直接QQ联系客服),我们立即给予删除!

温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们


网站客服QQ:2303240369

copyright@ 2017-2027 mayiwenku.com 

网站版权所有  智慧蚂蚁网络

经营许可证号:ICP备2024020385号



收起
展开