移动端

  • 题王微信公众号

    题王微信公众号

    微信搜“题王网”真题密题、最新资讯、考试攻略、轻松拿下考试

计算机考试 | Java认证考试

科目:

SCJP程序员认证考试

[切换]
题库
练习
考试
资讯

模式切换

0 0 0
我的错题 我的收藏 学习笔记

章节目录

多选题 interface A { public int getValue() }  class B implements A {  public int getValue() { return 1; }  }  class C extends B {  // insert code here  }  Which three code fragments, inserted individually at line 15, make use of polymorphism?()

A

 public void add(C c) { c.getValue(); }

B

 public void add(B b) { b.getValue(); }

C

 public void add(A a) { a.getValue(); }

D

 public void add(A a, B b) { a.getValue(); }

E

 public void add(C c1, C c2) { c1.getValue(); }

单选题 String a = null;  a.concat(“abc”);  a.concat(“def”);  System.out.println(a);   What is the result?()  

A

 abc

B

 null

C

 abcdef

D

 Compilation fails.

E

 The code runs with no output.

F

 An exception is thrown at runtime.

单选题 int x = 3;  int y = 1;  if (x = y) {  System.out.println(“x = “ + x);  }  What is the result? ()

A

x=1

B

x=3

C

Compilation fails.

D

The code runs with no output. 

E

An exception is thrown at runtime.

多选题 public interface Foo {  int k = 4; 3. }  Which three are equivalent to line 2?()

A

 final int k = 4;

B

 public int k = 4;

C

 static int k = 4;

D

 abstract int k = 4;

E

 volatile int k = 4;

F

 protected int k = 4;

单选题 public class X {   public static void main (Stringargs) {   int a = new int [1]   modify(a);   System.out.printIn(a[0]);   }   public static void modify (int a) {   a[0] ++;    }    }   What is the result?()  

A

 The program runs and prints “0”

B

 The program runs and prints “1”

C

 The program runs but aborts with an exception.

D

 An error “possible undefined variable” at line 4 causes compilation to fail.

E

 An error “possible undefined variable” at line 9 causes compilation to fail.

多选题 ArraryList a = new ArrayList();  a.add(“Alpha”);  a.add(“Bravo”):  a.add(“Charlie”);  a.add(“Delta”);  Iterator iter = a.iterator(); Which two, added at line 17, print the names in the ArrayList in alphabetical order?()

A

 for (int i=0; i< a.size(); i++)     System.out.println(a.get(i)));

B

 for (int i=0; i< a.size(); i++)     System.out.println(a[i]);

C

 while( iter.hasNext() )     System.out.println(iter.next()) ;

D

 for (int i=0, i< a.size(); i++)    System.out.println(iter[i]);

E

 for (int i=0; i< a.size(); i++)    System.out.println(iter.get(i));

多选题 class A {  A() { }  }  class B extends A {  }  Which two statements are true?()

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().

多选题 public abstract class Shape {  private int x;  private int y;  public abstract void draw();  public void setAnchor(int x, int y) {  this.x = x;  this.y = y;  }  }  Which two classes use the Shape class correctly?()

A

 public class Circle implements Shape { private int radius; }

B

 public abstract class Circle extends Shape { private int radius; }

C

 public class Circle extends Shape { private int radius; public void draw(); }

D

 public abstract class Circle implements Shape { private int radius; public void draw(); }

E

 public class Circle extends Shape { private int radius;public void draw() {/* code here */} }

F

 public abstract class Circle implements Shape { private int radius;public void draw() { / code here */ } }

首页 上一页 1 2 3 4 5 下一页 尾页 /

到第