求学资讯 JAVA培训 提问
JAVA培训 > 历年真题

JAVA认证SCJP认证真题及答案(17)

来源:用户上传 上传用户:zhongzhanen 发布时间:2017-12-28

导读:
想要第一时间获得JAVA考试报考信息,想要充分利用各种精华资讯资源备考,想要海量高质量、高含金量的习题练习,关注“求学快递网”公众号,你不能错过的考试利器!

  QUESTION NO 141

  Exhibit:

  1. class A {

  2. public String toString () {

  3. return “4”;

  4. }

  5. }

  6. class B extends A {

  7. 8. public String toString () {

  8. return super.toString() + “3”;

  9. }

  10. }

  11. public class Test {

  12. public static void main(Stringargs) {

  13. System.out.printIn(new B());

  14. }

  15. }

  What is the result?

  A. Compilation succeeds and 4 is printed.

  B. Compilation succeeds and 43 is printed.

  C. An error on line 9 causes compilation to fail.

  D. An error on line 14 causes compilation to fail.

  E. Compilation succeeds but an exception is thrown at line 9.

  Answer: B

  QUESTION NO 142

  Which two statements are true? (Choose Two)

  A. An anonymous inner class can be declared inside of a method

  B. An anonymous inner class constructor can take arguments in some situation.

  C. An anonymous inner class that is a direct subclass that is a direct subclass of Object can implement

  multiple interfaces.

  D. Even if a class Super does not implement any interfaces, it is still possible to define an anonymous

  inner class that is an immediate subclass of Super that implements a single interface.

  E. Event if a class Super does not implement any interfaces, it is still possible to define an anonymous

  inner class that is an immediate subclass of Super that implements multiple interfaces.

  Answer: A, B

  QUESTION NO 143 www.ExamW.CoM

  Given:

  1. public class MethodOver {

  2. private int x, y;

  3. private float z;

  4. public void setVar(int a, int b, float c){

  5. x = a;

  6. y = b;

  7. z = c;

  8. }

  9. }

  Which two overload the setVar method? (Choose Two)

  A. void setVar (int a, int b, float c){

  x = a;

  y = b;

  z = c;

  }

  B. public void setVar(int a, float c, int b) {

  setVar(a, b, c);

  }

  C. public void setVar(int a, float c, int b) {

  this(a, b, c);

  }

  D. public void setVar(int a, float b){

  x = a;

  z = b;

  }

  E. public void setVar(int ax, int by, float cz) {

  x = ax;

  y = by;

  z = cz;

  }

  Answer: B, D

  QUESTION NO 144

  Which statements about static inner classes are true? (Choose Two)

  A. A static inner class requires a static initializer.

  B. A static inner class requires an instance of the enclosing class.

  C. A static inner class has no reference to an instance of the enclosing class.

  D. A static inner class has access to the non-static members of the outer class.

  E. Static members of a static inner class can be referenced using the class name of the static inner

  class.

  Answer: C, E

  QUESTION NO 145

  Given:

  1. public class X {

  2. public object m () {

  3. object o = new float (3.14F);

  4. object oa = new object [1];

  5. oa[0]= o;

  6. o = null;

  7. oa[0] = null;

  9. return o;

  9. }

  10. }

  When is the float object created in line 3, eligible for garbage collection?

  A. Just after line 5.

  B. Just after line 6.

  C. Just after line 7.

  D. Just after line 8(that is, as the method returns).

  Answer: C

  QUESTION NO 146

  Which two interfaces provide the capability to store objects using a key-value pair? (Choose Two)

  A. Java.util.Map.

  B. Java.util.Set.

  C. Java.util.List.

  D. Java.util.StoredSet.

  E. Java.util.StoredMap.

  F. Java.util.Collection.

  Answer: A, E

  QUESTION NO 147

  Which interface does java.util.Hashable implement?

  A. Java.util.Map.

  B. Java.util.List.

  C. Java.util.Hashable.

  D. Java.util.Collection.

  Answer: A

声明:本站为免费网络服务提供商,网站所有信息均为用户自行发布并由用户承担相应法律责任,本站不对其真实性及合法性负责,如涉及侵权或者信息违法,请你及时与本站联系删除。

阅读 1039 举报

相关推荐
评论0

当前没有评论内容

发表评论 0条评论
97
微博
QQ
QQ空间
微信
取消