classCatextendsAnimal{}对于下述代码说法正确的是()A、Cat是Animal的子类B、Animal是Cat的子类C、Cat是Animal的超类D、Animal一定是抽象类

题目

classCatextendsAnimal{}对于下述代码说法正确的是()

  • A、Cat是Animal的子类
  • B、Animal是Cat的子类
  • C、Cat是Animal的超类
  • D、Animal一定是抽象类

相似考题
参考答案和解析
正确答案:A
更多“classCatextendsAnimal{}对于下述代码说法正确的是()A、Cat是Animal的子类B、Animal是Cat的子类C、Cat是Animal的超类D、Animal一定是抽象类”相关问题
  • 第1题:

    若Animal是Cat,Dog的父类,则下列选项中,正确的是()。

    A.Animalanimal=newCat()

    B.Catcat=(Cat)newDog()

    C.Catcat=(Cat)newAnimal()

    D.Animalanimal=newDog()


    参考答案:D

  • 第2题:

    classAnimal{AnimalgetOne(){returnnewAnimal();}}classDogextendsAnimal{//insertcodehere}classAnimalTest{publicstaticvoidmain(String[]args){Animal[]animal={newAnimal(),newDog()};for(Animala:animal){Animalx=a.getOne();}}}和代码:3a.DoggetOne(){returnnewDog();}3b.AnimalgetOne(){returnnewDog();}第3行中插入的哪项编译且运行无异常?

    A.3a行或3b行

    B.既非3a,也非3b

    C.3a行

    D.3b行


    参考答案:A

  • 第3题:

    dog是animal的子类,下面代码错误的是_________。

    A.Objecto=newDog();

    B.Animala=newDog();

    C.Objectd=(Dog)newAnimal()

    D.Animala=(Animal)newDog();


    正确答案:C

  • 第4题:

    假定在窗体(名称为Form1)的代码窗口中定义如下记录类型:

    Private Type animal

    AnimalName As String*20

    AColor As String*10

    End Type

    在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程:

    Private Sub Command1_Click()

    Dim rec As animal

    Open "c:\vbTest.dat" For Random As #1 Len = Len(rec)

     rec.animalName = "Cat"

     rec.aColor = "White"

     Put #1, , rec

    Close #1

    End Sub

    则以下叙述中正确的是( )。

    A.记录类型animal不能在Form1中定义,必须在标准模块中定义

    B.如果文件c:\vbTest.dat不存在,则Open命令执行失败

    C.由于Put命令中没有指明记录号,因此每次都把记录写到文件的末尾

    D.语句“Put #1, , rec”将animal类型的两个数据元素写到文件中


    正确答案:C

  • 第5题:

    Animal is a super-ordinate term, while cow, horse, pig, dog, cat, etc. are().
    hyponyms

  • 第6题:

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

    • A、 Cat is-a Animal
    • B、 Cat is-a Jumper
    • C、 Dog is-a Animal
    • D、 Dog is-a Jumper
    • E、 Cat has-a Animal
    • F、 Beagle has-a Tail
    • G、 Beagle has-a Jumper

    正确答案:B,F

  • 第7题:

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

    正确答案:D

  • 第8题:

    11. class Animal { public String noise() { return “peep”; } }  12. class Dog extends Animal {  13. public String noise() { return “bark”; }  14. }  15. class Cat extends Animal {  16. public String noise() { return “meow”; }  17. }  .....  30. Animal animal = new Dog();  31. Cat cat = (Cat)animal;  32. System.out.printIn(cat.noise());  What is the result?() 

    • A、 peep
    • B、 bark
    • C、 meow
    • D、 Compilation fails.
    • E、 An exception is thrown at runtime.

    正确答案:E

  • 第9题:

    1. class Animal { Animal getOne() { return new Animal(); } }  2. class Dog extends Animal {  3. // insert code here   4. }  5.  6. class AnimalTest {  7. public static void main(String [] args) {  8. Animal [] animal = { new Animal(), new Dog() } ;  9. for( Animal a : animal) {  10. Animal x = a.getOne();  11. }  12. }  13. }  和代码:  3a. Dog getOne() {  return new Dog();  }  3b. Animal getOne() {  return new Dog();  }  第 3 行中插入的哪项将编译且运行无异常?() 

    • A、3a行
    • B、3b行
    • C、3a行或3b行
    • D、既非3a,也非3b

    正确答案:D

  • 第10题:

    多选题
    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?()
    A

    Cat is-a Jumper

    B

    Cat is-a Animal

    C

    Dog is-a Jumper

    D

    Dog is-a Animal

    E

    Beagle has-a Jumper

    F

    Cat has-a Animal

    G

    Beagle has-a Tail


    正确答案: F,B
    解析: 暂无解析

  • 第11题:

    填空题
    Animal is a super-ordinate term, while cow, horse, pig, dog, cat, etc. are().

    正确答案: hyponyms
    解析: 暂无解析

  • 第12题:

    多选题
    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?()
    A

    Cat is-a Animal

    B

    Cat is-a Jumper

    C

    Dog is-a Animal

    D

    Dog is-a Jumper

    E

    Cat has-a Animal

    F

    Beagle has-a Tail

    G

    Beagle has-a Jumper


    正确答案: A,D
    解析: 暂无解析

  • 第13题:

    以下关于C#代码的说法正确的是()publicabstractclassAnimal{publicabstractvoidEat();publicvoidSleep(){}}

    A、代码编译错误,因为类中方法没有实现

    B、代码编译错误,因为类中存在非抽象方法

    C、该段代码正确

    D、通过代码”Animalan=newAnimal();”可以创建一个Animal对象


    参考答案:C

  • 第14题:

    11.classAnimal{publicStringnoise(){returnpeep”;}}12.classDogextendsAnimal{13.publicStringnoise(){returnbark”;}14.}15.classCatextendsAnimal{16.publicStringnoise(){returnmeow”;}17.}.....30.Animalanimal=newDog();31.Catcat=(Cat)animal;32.System.out.printIn(cat.noise());Whatistheresult?()

    A.peep

    B.bark

    C.meow

    D.Compilationfails.

    E.Anexceptionisthrownatruntime.


    参考答案:E

  • 第15题:

    下列程序片段中,能通过编译的是( )。 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{};}


    正确答案:A
    A。【解析】Java中一个类是一个abstract类的子类,它必须具体实现父类的abstract方法。如果一个类中含有abstract方法,那么这个类必须用abstract来修饰(abstract类也可以没有abstract方法)。有abstract方法的父类只声明,由继承它的子类实现。所以选A。

  • 第16题:

    材料题
    D
    With the large number of dogs roaring through our communities,people need to know the facts about rabies(狂犬病),a fatal disease caused by animal bites.Despite vaccination(接種疫苗)programs,rabies is still very prevalent,and will continue to be a serious public health problem for many years to come.
    Rabies strikes the central nervous system and brings on choking,convulsions(抽搐)and inability to swallow liquids.It can even cause death.If you or anyone in your family is bitten by dog,cat or other animal,you should not panic,but thoroughly wash the wound with plenty of soap and water and rush to nearby hospital for immediate treatment.If you own the animal which did the biting,you should immediately call a veterinarian for advice and make sure the public health authorities know when and where the biting took place and who was bitten.
    ()Rabies is a kind of disease which________.

    Which is the best title of the passage

    A.What a Rabies
    B.The Horrible Rabies
    C.What Are Animal Bites
    D.How to Control Rabies

    答案:B
    解析:

  • 第17题:

    在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、 0
    • B、 1
    • C、 2
    • D、3
    • E、3.3333

    正确答案:D

  • 第18题:

    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行中插入的哪项编译且运行无异常?  

    • A、3a行或3b行
    • B、既非3a,也非3b
    • C、3a行
    • D、3b行

    正确答案:A

  • 第19题:

    publicabstractclassAnimal{publicabstractvoidEat();publicvoidSleep(){}}以下关于C#代码地描述正确的是()。

    • A、该段代码正确
    • B、代码错误〃因为类中存在非抽象方法
    • C、代码错误〃因为类中方法没有实现
    • D、通过代码Animalan=newAnimal;可以创建一个Animal对象

    正确答案:A

  • 第20题:

    现有:  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

    正确答案:C

  • 第21题:

    现有:  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行,有几个可以通过编译?() 

    • A、0
    • B、1
    • C、2
    • D、3

    正确答案:D

  • 第22题:

    单选题
    publicabstractclassAnimal{publicabstractvoidEat();publicvoidSleep(){}}以下关于C#代码地描述正确的是()。
    A

    该段代码正确

    B

    代码错误〃因为类中存在非抽象方法

    C

    代码错误〃因为类中方法没有实现

    D

    通过代码Animalan=newAnimal;可以创建一个Animal对象


    正确答案: A
    解析: 暂无解析

  • 第23题:

    单选题
    11. class Animal { public String noise() { return “peep”; } }  12. class Dog extends Animal {  13. public String noise() { return “bark”; }  14. }  15. class Cat extends Animal {  16. public String noise() { return “meow”; }  17. }  .....  30. Animal animal = new Dog();  31. Cat cat = (Cat)animal;  32. System.out.printIn(cat.noise());  What is the result?()
    A

     peep

    B

     bark

    C

     meow

    D

     Compilation fails.

    E

     An exception is thrown at runtime.


    正确答案: E
    解析: 暂无解析