SCJP真题库更新11

 

QUESTION 46

1.public class Test{

2.     int x = 12;

3.     public void method(int x ){

4.             x +=  x;

5.             System.out.println( x);

6.     }

7.}

And:

22.    Test t = new Test();

23.   t.method(5);

What is the output from line 5 of the Certkiller class? 

A. 5

B. 10

C. 12

D. 17

E. 24

 

 

Answer: ( B )

参考大纲:语言基础

 

QUESTION 47

Given the exhibit:

 

Which two methods, inserted individually, correctly complete the Certkiller 3 class?

(choose two) 

A. public void foo ( ) { }

B. public int foo ( ) {return 3: }

C. public CertKiller2 foo ( ) { return this;}

D. public Certkiller1 foo ( ) {return this;}

 

 

Answer: ( C, D )

返回值要么和原来的相同要么就是直系子类,原方法返回的是Certkiller1类,所以返回Certkiller2也是正确的。

参考大纲:面向对象 覆写和覆载

 

QUESTION 48

Exhibit:

 

What is the result? 

A. snootchy 420 third second first

B. snootchy 420 first second third

C. first second third snootchy 420

D. third second first snootchy 420

E. thirds first second snootchy 420

F. first second first third snootchy 420

 

 

Answer: ( D )

参考大纲:面向对象 —构造器覆载和方法的递归调用

 

QUESTION 49

Given the exhibit:

 

What is the result? 

A. 1 2 3

B. Compiltion fails because of an error in line 12.

C. Compilation fails because of an error in line 13

D. Compilation fails because of an error in line 14.

E. A ClassCastException is thrown at runtime

 

 

Answer: ( A )

参考大纲:流程控制、类型转换

 

QUESTION 50

A Java Bean component has the following field:

11. private Boolean enabled;

Which two pairs of method declarations follow the JavaBean standard for accessing this fields? (choose two) 

 

A.    public void setEnabled ( Boolean enabled)

public Boolean getEnabled ( )

B.    public void setEnabled ( Boolean enabled)

public void isEnabled ( )

C.     public void setEnabled ( Boolean enabled)

public Boolean isEnabled ( )

D.    public Boolean setEnabled ( Boolean enabled)

public void getEnabled ( )

 

 

Answer: ( A, C )

参考大纲:语言基础 JavaBean

 

你可能感兴趣的:(scjp,真题)