- 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
网络认证考试复习题库
OCJP认证考试方向复习资料
命题方向:
Oracle 认证Java 程序员OCJP5 和OCJP6考试均包含以下七个部分的知识:
1. 生命周期、初始化与作用域
2. 流程控制
3. API 内容
4. 并发
5. 面向对象的概念
6. 集合/泛型
7. 基础知识
复习参考题库也是来自于这七大方向的内容,仅供练习测试。
选择题(不定项选择题,根据问题后面的答案数量提示选择答案)
Given the command line java Pass2 and:
15. public class Pass2 {
16. public void main(String [] args) {
17. int x=6;
18. Pass2 p = new Pass2();
19. p.doStuff(x);
20. System.out.print(main x = + x);
21. }
22.
23. void doStuff(int x) {
24. System.out.print( doStuffx =+ x++);
25. }
26. }
What is the result?
A. Compilation fails.
B. An exception is thrown at runtime.
C. doStuffx = 6 main x = 6
D. doStuffx = 6 main x = 7
E. doStuffx = 7 main x = 6
F. doStuffx = 7 main x = 7 答案:D
12. public class Yippee2 {
13.
14. static public void main(String [] yahoo) {
15. for(int x= 1; xyahoo.length; x++) {
16. System.out.print(yahoo[x] + );
17. }
18. }
19. }
and the command line invocation:
java Yippee2 a b c
What is the result?
A.a b
B.b c
C.a b c
D. Compilation fails.
E. An exception is thrown at runtime. 答案:B
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]); 答案:BD
Which two code fragments correctly create and initialize a static array
of int elements? (Choose two.)
A. static final int[] a = { 100,200 };
B. static final int[] a;
static { a=new int[2]; a[0]=100; a[1]=200; }
C. static final int[] a = new int[2] { 100,200 };
D. static final int[] a;
static void init() { a = new int[3]; a[0]=100; a[1]=200; } 答案:AB
10. class One {
11. void foo() {}
12. }
13. class Two extends One {
14. //insert method here
15. }
Which three methods, inserted individually(单独) at line 14, will correctly
complete class Two? (Choose three.)
A. int foo() { /
文档评论(0)