易搜题 > 资格证大类 > 计算机编程 > 问题详情
问题详情

Which two demonstrate an “is a” relationship? ()

A

 public interface Person{}  public class Employee extends Person{}

B

 public interface Shape{}  public class Employee extends Shape{}

C

 public interface Color{}  public class Employee extends Color{}

D

 public class Species{}  public class Animal (private Species species;)

E

 interface Component{}  Class Container implements Component (  Private Component[ ] children;  )

未找到的试题在搜索页框底部可快速提交,在会员中心"提交的题"查看可解决状态。 收藏该题
查看答案

相关问题推荐

  • public class Yippee2 {  static public void main(String [] yahoo) {  for(int x= 1; xSystem.out.print(yahoo[x] + “ “);  }  }  }  and the command line invocation: java Yippee2 a b c What is the result?() 

    A、a b

    B、b c

    C、a b c

    D、 Compilation fails.

    E、 An exception is thrown at runtime.

  • Consider the following class:     class Test(int i) {     void test(int i) {  System.out.println(“I am an int.”); }    void test(String s) {   System.out.println(“I am a string.”);     }          public static void main(String args) {    Test t=new Test();     char ch=“y”;    t.test(ch);     }      }     Which of the statements below is true?()

    A、 Line 5 will not compile, because void methods cannot be overridden.

    B、 Line 12 will not compile, because there is no version of test() that rakes a charargument.

    C、 The code will compile but will throw an exception at line 12.

    D、 The code will compile and produce the following output: I am an int.

    E、 The code will compile and produce the following output: I am a String.

  • Which two changes, taken together, would guarantee the output: 1, 2, 3, 4, 5?()

    A

    move the line 12 print statement into the foo() method

    B

    change line 7 to public synchronized void go(){

    C

    change the variable declaration on line 2 to private volatile int x;

    D

    wrap the code inside the foo() method with a synchronized(this) block

    E

    wrap the for loop code inside the go() method with a synchronized block synchronized(this){//for loop code here}

  • public class X {  public X aMethod() { return this;}  }  public class Y extends X {  }  Which two methods can be added to the definition of class Y?()

    A

     public void aMethod() {}

    B

     private void aMethod() {}

    C

     public void aMethod(String s) {}

    D

     private Y aMethod() { return null; }

    E

     public X aMethod() { return new Y(); }

  • Assume that country is set for each class.  Given:  10. public class Money {  11. private String country, name;  12. public getCountry() { return country; }  13.}  and:  24. class Yen extends Money {  25. public String getCountry() { return super.country; }  26. }  27.  28. class Euro extends Money {  29. public String getCountry(String timeZone) {  30. return super.getCountry();  31. }  32. }  Which two are correct?()

    A

     Yen returns correct values.

    B

     Euro returns correct values.

    C

     An exception is thrown at runtime.

    D

     Yen and Euro both return correct values.

    E

     Compilation fails because of an error at line 25.

    F

     Compilation fails because of an error at line 30.

联系客服 会员中心
TOP