OCJP认证解析3.doc

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

Exam : 1Z0-851 Java Standard Edition 6?Programmer Certified?Professional Exam 以下分析全都是我自己分析或者参考网上的,定有疏漏,还请大家对我的分析提出质疑。 QUESTION 61 Given: 1. public class TestString1 { 2. public static void?main(String[] args) { 3. String str = 420; 4. str += 42; 5. System.out.print(str); 6. } 7. } What is the output? A. 42 B. 420 C. 462 D. 42042 E. Compilation fails. F. An exception is thrown at runtime. Answer: D 42会自动类型转换成String类型。 QUESTION 62 Given: 12. Date date = new Date(); 13. df.setLocale(Locale.ITALY); 14. String s = df.format(date); The variable df is an object of type DateFormat that has been initialized in line 11. What is the result if this code is run on December 14, 2000? A. The value of s is 14-dic-2000. B. The value of s is Dec 14, 2000. C. An exception is thrown at runtime. D. Compilation fails because of an error in line 13. Answer: D 设置地点不是这样设置,如下: Locale.setDefault(Locale.US);//设置为美国地区?? QUESTION 63 Given: 1. public class KungFu { 2. public static void main(String[] args) { 3. Integer x = 400; 4. Integer y = x; 5. x++; 6. StringBuilder sb1 = new StringBuilder(123); 7. StringBuilder sb2 = sb1; 8. sb1.append(5); 9. System.out.println((x==y) + + (sb1==sb2)); 10. } 11. } What is the result? A. true true B. false true C. true false D. false false E. Compilation fails. F. An exception is thrown at runtime. Answer: B x与y引用相同的对象400,但是x++即x = x + 1; 使x引用401,而y依然引用400,输出false。 QUESTION 64 Given that the current directory is empty, and that the user has read and write privileges to the current directory, and the following: 1. import java.io.*; 2. public class Maker { 3. public static void main(String[] args) { 4. File dir = new File(dir); 5. File f = new File(dir, f); 6. } 7. } Which statement is true? A. Compilation fails. B. Nothing is added to the file system. C. Only a new file is created on the file system. D. Only a new directory is created on the file system. E. Both a new file and a new directory are created on the file system. Answer: B 没调用creat函数,不会是文件系统

文档评论(0)

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

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

1亿VIP精品文档

相关文档