单选题现有:  interface Animal {       void eat () ;       }       //insert code here       public class HouseCat extends Feline {       public void eat() { }       }  和五个申明  abstract class Feline implements Animal { }  abstract  class  Feline  implements  Animal  {  void eat () ;  }  abstract class Feline implements Animal { public void eat();}  abstract class Feline implements Animal { public void eat() {}  }  abstract class Feline implements Animal { abstract public void eat();} 结果为:()A1B2C3D4

单选题
现有:  interface Animal {       void eat () ;       }       //insert code here       public class HouseCat extends Feline {       public void eat() { }       }  和五个申明  abstract class Feline implements Animal { }  abstract  class  Feline  implements  Animal  {  void eat () ;  }  abstract class Feline implements Animal { public void eat();}  abstract class Feline implements Animal { public void eat() {}  }  abstract class Feline implements Animal { abstract public void eat();} 结果为:()
A

1

B

2

C

3

D

4


参考解析

解析: 暂无解析

相关考题:

有如下程序: include using namespaee std;class Animal{ public: virtual char*g 有如下程序:include<iostream>using namespaee std;c lass Animal{public:virtual char*getType( )const{return"Animal";}virtual char*getVoice( )const{return"Voice";}};class Dog:public Animal{public:char*getType( )const{return"Dog";}char*getVoice( )eonst{return"Woof";}};void type(AnimalA) {cout<<a.getType( );}void speak(Animal A) {eout<<a.getVoice( );}int main( ){Dog d;type(D) ;cout<<"speak";speak(D) ;cout return 0;}程序的输出结果是______。

下列程序片段中,能通过编译的是A.public abstract class Animal{ public void speak();}B.public abstract class Animal{ public void speak(){}}C.public class Animal{ public abstract void speak();}D.public abstract class Animal{ public abstract void speak(){}}

( 12 )有如下程序:#include iostreamusing namespace stdclass Animal{public:virtual char* getType () const { return "Animal" ; }virtual char* getVoice () const { return "Voice" ; }};Class Dog : public Animal {public:char* getType ( ) const {return "Dog" ; }char* getVoice ( ) const {return "Woof"}};void type ( Animal a ) {couta.getType ( ) ; }void speak ( Animal a ) {couta.getVoice ( ) ; }int main ( ) {Dog d; type ( d ) ; cout" speak" ; speak ( d ) ; coutendi;return 0;}运行时的输出结果是【 12 】 。

Given:10. interface Data { public void load(); }11. abstract class Info { public abstract void load(); }Which class correctly uses the Data interface and Info class?()() A.B.C.D.E.F.

使用VC6打开考生文件夹下的工程test19_1,此工程包含一个源程序文件test19_1.cpp,但该程序运行有问题,请改正程序中的错误,使程序的输出结果如下:1:weight:5age:02:weight:7age:9源程序文件test19_1.cpp 清单如下:include <iostream.h>class animal{public:/**************** found *******************/friend void setvalue(animal,int);/**************** found *******************/void print()protected:int itsweight;int itsage;};void animal::print(){cout<<"weight:"<<itsweight<<end1;cout<<"age:"<<itsage<<end1;}void setvalue(animal ta,int tw){ta.itsweight=tw;ta.ihsage=0;}void setvalue(animal ta,int tw, int tn){ta.itsweight=tw;ta.itsage=tn;}void main(){/**************** found *******************/animal peppysetvalue(peppy,5);cout<<"1:"<<end1;peppy.print();setvalue(peppy,7,9);cout<<"2:"<<end1;peppy.print();}

有如下程序:ncludeiostreamusing namespace std;class Animal{public:virtual char*getType()const{return“Animal”;}virtual char*getVoice()const{return“Voice”;}};class Dog:public Animal{public:char*getType()const{rgturn“Dog”;}char*getVoice()const{retum“Woof”;}};void type(AnimalA){couta.getType();}void speak(AnimalA){couta.getVoice();}int main(){Dog d.type(D);tout“speak”;speak(D);coutendl;return 0;}运行时的输出结果是【 】

interface Playable {void play();}interface Bounceable {void play();}interface Rollable extends Playable, Bounceable {Ball ball = new Ball("PingPang");}class Ball implements Rollable {private String name;public String getName() {return name;}public Ball(String name) {this.name = name;}public void play() {ball = new Ball("Football");System.out.println(ball.getName());}}这个错误不容易发现。

下列程序片段中,能通过编译的是( )。 A.public abstract class Animal{ public void speak;}S 下列程序片段中,能通过编译的是( )。A.public abstract class Animal{ public void speak;}B.public abstract class Animal{ public void speak{);}C.public class Animal{ pubilc abstract void speak;}D.public abstract class Animal{ pubile abstract void speak{};}

public interface A {  String DEFAULT_GREETING = “Hello World”;  public void method1();  }  A programmer wants to create an interface called B that has A as its parent. Which interface declaration is correct?() A、 public interface B extends A {}B、 public interface B implements A {}C、 public interface B instanceOf A {}D、 public interface B inheritsFrom A {}

现有:  1.  interface Animal  f      2.    void eat();      3.    }      4.  5.  // insert code here      6.  7. public class HouseCat implements Feline  {      8.    public void eat()    {  }     9.  }  和以下三个接口声明:  interface Feline extends Animal  (  )  interface Feline extends Animal  {void eat();    }  interface Feline extends Animal  {void eat()    {  }  }   分别插入到第5行,有多少行可以编译?   A、  0B、  1C、  2D、  3

现有:  interface  I  {  void go();  }      abstract class A implements I { }      class C extends A  {     void go(){ }     }  结果是什么?()   A、代码通过编译B、由于第1行的错误导致编译失败C、由于笫3行的错误导致编译失败D、由于第6行的错误导致编译失败

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?()  A、 new Animal().soundOff();B、 Elephant e = new Alpha1();C、 Lion 1 = Alpha.get(“meat eater”);D、 new Alpha1().get(“veggie”).soundOff();

Given the following interface definition, which definitions are valid?()   interface I {   void setValue(int val);   int getValue();   }    DEFINITION a:   (a) class a extends I {  int value;   void setValue(int val) { value = val;  }   int getValue() {  return value;  }   }   DEFINITION b:   (b) interface b extends I {   void increment();   }   DEFINITION c:   (c) abstract class c implements I {   int getValue() {  return 0;  }  abstract void increment();   }   DEFINITION d:   (d) interface d implements I {  void increment();  }   DEFINITION e:   (e) class e implements I {  int value;   public void setValue(int val) { value = val; }  }  A、Definition a.B、Definition b.C、Definition c.D、Definition d.E、Definition e.

Which method must be defined by a class implementing the java.lang.Runnable interface? () A、 void run()B、 public void run()C、 public void start()D、 void run(int priority)E、 public void run(int priority)F、 public void start(int priority)

Which the two demonstrate an “is a” relationship?()A、 public interface Person {}  Public class Employee extends Person {}B、 public interface Shape {}  public interface Rectangle extends Shape {}C、 public interface Color {}  public class Shape { private Color color; }D、 public class Species {}  public class Animal { private Species species; }E、 interface Component {} Class Container implements Component {private Component [] children;

多选题Given: 10. interface Jumper { public void jump(); } ...   20. class Animal {} ...   30. class Dog extends Animal {   31. Tail tail;   32. }   ...   40. class Beagle extends Dog implements Jumper{   41. public void jump() {}  42. }   ...   50. class Cat implements Jumper{   51. public void jump() {}   52. }. Which three are true?()ACat is-a JumperBCat is-a AnimalCDog is-a JumperDDog is-a AnimalEBeagle has-a JumperFCat has-a AnimalGBeagle has-a Tail

单选题Which method must be defined by a class implementing the java.lang.Runnable interface? ()A void run()B public void run()C public void start()D void run(int priority)E public void run(int priority)F public void start(int priority)

单选题现有:  interface Data {public void load();}  abstract class Info {public abstract void load();}      下列类定义中正确使用Data和Info的是哪项?()A public class Employee implements Info extends Data { public void load(){/*dosomething*/}     }Bpublic class Employee extends Inf.implements Data{ public void load() {/*do something*/}     }Cpublic class Empl.yee implements Inf extends Data{ public void Data.1oad(){* do something*/}     public void load(){/*do something*/}     }Dpublic class Employee extends Inf implements Data  {  public void Data.1oad()  {/*do something*/)     public void info.1oad(){/*do something*/}    }

单选题在Java中,类Animal中的方法printA()定义如下:  public void printA() {    Int a=10;    Int result =10%3;    System.out.println(result); }  在类Dog中方法printA()定义如下:  public void printA() {   Int a=10;    System.out.println(a/3); }  Dog类的定义如下:  Class Dog extends Animal{…}.  Animal animal=new Dog();  animal.printA();  以上语句输出结果为()。A 0B 1C 2D3E3.3333

单选题现有:  1. interface Animal {  2. void eat();  3. }  4.  5. // insert code here  6.  7. public class HouseCat extends Feline {  8. public void eat() { }  9. }   和五个声明:  abstract class Feline implements Animal { }  abstract class Feline implements Animal { void eat(); }  abstract class Feline implements Animal { public void eat(); }  abstract class Feline implements Animal { public void eat() { } }  abstract class Feline implements Animal { abstract public void eat(); }  分别插入到第5行,有几个可以通过编译?()A0B1C2D3

多选题Which the two demonstrate an “is a” relationship?()Apublic interface Person {}  Public class Employee extends Person {}Bpublic interface Shape {}  public interface Rectangle extends Shape {}Cpublic interface Color {}  public class Shape { private Color color; }Dpublic class Species {}  public class Animal { private Species species; }Einterface Component {} Class Container implements Component {private Component [] children;

单选题public interface A {  String DEFAULT_GREETING = “Hello World”;  public void method1();  }  A programmer wants to create an interface called B that has A as its parent. Which interface declaration is correct?()A public interface B extends A {}B public interface B implements A {}C public interface B instanceOf A {}D public interface B inheritsFrom A {}

多选题10. interface Jumper { public void jump(); }  ......  20. class Animal {}  ......  30. class Dog extends Animal { 31. Tail tail; 32. }  ......  40. class Beagle extends Dog implements Jumper {  41. public void jump() { }  42. }  .......  50. class Cat implements Jumper {  51. public void jump() { }  52. }  Which three are true?()ACat is-a AnimalBCat is-a JumperCDog is-a AnimalDDog is-a JumperECat has-a AnimalFBeagle has-a TailGBeagle has-a Jumper

单选题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?()A new Animal().soundOff();B Elephant e = new Alpha1();C Lion 1 = Alpha.get(“meat eater”);D new Alpha1().get(“veggie”).soundOff();

单选题现有:  1.  interface Animal  f      2.    void eat();      3.    }      4.  5.  // insert code here      6.  7. public class HouseCat implements Feline  {      8.    public void eat()    {  }     9.  }  和以下三个接口声明:  interface Feline extends Animal  (  )  interface Feline extends Animal  {void eat();    }  interface Feline extends Animal  {void eat()    {  }  }   分别插入到第5行,有多少行可以编译?A  0B  1C  2D  3

单选题1. interface Animal {   2. void eat();   3. }   4.   5. // insert code here   6.   7. public class HouseCat implements Feline {   8. public void eat() { }   9. }   和以下三个接口声明:   interface Feline extends Animal { }   interface Feline extends Animal { void eat(); }   interface Feline extends Animal { void eat() { } }   分别插入到第 5 行,有多少行可以编译?()A0B1C2D3

单选题class Animal{ Animal getOne(){return new Animal();}}   class Dog extends Animal{   //insert code here   }   class AnimalTest{   public static void main(String[] args){   Animal[] animal={ new Animal(), new Dog()};   for(Animal a:animal){   Animal x= a.getOne();   }   }   }   和代码:   3a.Dog getOne() { return new Dog();}   3b.Animal getOne() { return new Dog();}   第3行中插入的哪项编译且运行无异常?A3a行或3b行B既非3a,也非3bC3a行D3b行