移动端

  • 题王微信公众号

    题王微信公众号

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

单选题

interface Animal {  void soundOff();  }  class Elephant implements Animal {  public void soundOff() {  System.out.println(“Trumpet”);  }  }  class Lion implements Animal {  public void soundOff() { System.out.println(“Roar”);  }  }  class Alpha1 {  static Animal get( String choice ) {  if ( choice.equalsIgnoreCase( “meat eater” )) {  return new Lion();  } else {  return new Elephant();  }  }  }  Which compiles?()  

发布日期:2020-04-10

interface Animal {  void soundOff();  }  class Ele...
A

new Animal().soundOff();

B

Elephant e = new Alpha1();

C

Lion 1 = Alpha.get(“meat eater”);

D

new Alpha1().get(“veggie”).soundOff();

题王网让考试变得更简单

扫码关注题王,更多免费功能准备上线!

此试题出现在

CMS专题

CMS专题

去刷题
热门试题热门资讯 相关试题

暂无相关推荐~

接口Animal定义如下: public interface Animal {void Move();} 则下列抽象类的定义中,哪些是不合法的?()

interface Animal {  void soundOff();  }  class Elephant implements Animal {  pub...

1. interface Animal {   2. void eat();   3. }   4.   5. // insert code here   6....

现有:  1.  interface Animal  f      2.    void eat();      3.    }      4.  5.  //...

现有:  1. interface Animal {  2. void eat();  3. }  4.  5. // insert code here  6....

现有:  interface Animal {       void eat () ;       }       //insert code here    ...

现有:   1. interface Animal {    2.   void eat();   3.  }    4.   5. // insert cod...

1. interface A { public void aMethod(); }  2. interface B { public void bMethod(...

在Java中,类Animal中的方法printA()定义如下:  public void printA() {    Int a=10;    Int resu...

在Java中,类Animal中的方法printA()定义如下:  public void printA() {    Int a=10;    Int resu...