Sun Certified Programmer_310-035

QUESTION NO: 5
310 - 035
Leading the way in IT testing and certification tools, www.testking.com
-5 -
Given:
1. interface Animal {
2. void soundOff();
3. }
4.
5. class Elephant implements Animal {
6. public void soundOff() {
7. System.out.println(“Trumpet”);
8. }
9. }
10.
11. class Lion implements Animal {
12. public void soundOff() {
13. System.out.println(“Roar”);
14. }
15. }
16.
17. class Alpha1 {
18. static Animal get( String choice ) {
19. if ( choice.equalsIgnoreCase( “meat eater” )) {
20. return new Lion();
21. } else {
22. return new Elephant();
23. }
24. }
25. }
Which compiles?//意思是扏行哪一个能正常运行
A. new Animal().soundOff();
B. Elephant e = new Alpha1();
C. Lion 1 = Alpha.get(“meat eater”);
D. new Alpha1().get(“veggie”).soundOff();
Answer: D

---------------------------------------------------------------------------------------------------------------------------------------------------

QUESTION NO: 6
Which statement is true?
A. Memory is reclaimed by calling Runtime.gc().
B. Objects are not collected if they are accessible from live threads.

/*意思是对象不被垃圾回收器收集,如果有活动的线程在防问。这是对的,因为的线程防问它就一定存在某一引用变量存储这个对象的引用值(句柄)*/
C. Objects that have finalize() methods are never garbage collected.
D. Objects that have finalize() methods always have their finalize() methods called before
the program ends.
E. An OutOfMemory error is only thrown if a single block of memory cannot be found
that is large enough for a particular requirement.
310 - 035
Leading the way in IT testing and certification tools, www.testking.com
-6 -
Answer: B

-------------------------------------------------------------------------------------------------------------------------------------------------

QUESTION NO: 7
Given:
1. class A {
2. A() { }
3. }
4.
5. class B extends A {
6. }
Which two statements are true? (Choose two)
A. Class B’s constructor is public.
B. Class B’s constructor has no arguments.
C. Class B’s constructor includes a call to this().
D. Class B’s constructor includes a call to super().
Answer: B, D

--------------------------------------------------------------------------------------------------------------------------------------------------

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值