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

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值