• 2022-06-06 问题

    编写抽象类Animal,其中Animal抽象类有2个抽象方法voidcry()和StringgetAnimalName(),分别表示要求动物给出自己的叫声和种类名称。然后,编写Animal类的子类:Dog,Cat类,要求实现抽象类中的抽象方法。main主方法如下:Animalanimal;animal=newDog();System.out.println(animal.getAnimalName());animal.cry();animal=newCat();System.out.println(animal.getAnimalName());animal.cry();

    编写抽象类Animal,其中Animal抽象类有2个抽象方法voidcry()和StringgetAnimalName(),分别表示要求动物给出自己的叫声和种类名称。然后,编写Animal类的子类:Dog,Cat类,要求实现抽象类中的抽象方法。main主方法如下:Animalanimal;animal=newDog();System.out.println(animal.getAnimalName());animal.cry();animal=newCat();System.out.println(animal.getAnimalName());animal.cry();

  • 2022-06-06 问题

    应用编程题(共8分) 设计一个动物声音“模拟器”,希望模拟器可以模拟许多动物的叫声,要求如下: 1.编写抽象类Animal Animal抽象类有两个抽象方法cry()和getAnimalName(),即要求各种具体的动物给出自己的叫声和种类名称。 2.编写模拟器类Simulator 该类有一个playSound(Animal animal)方法,该方法的参数是Animal类型。即参数animal可以调用Animal的子类重写cry()方法播放具体动物的声音,调用子类重写的getAnimalName()方法显示动物种类的名称。 3.编写Animal类的子类:Dog和Cat类 Dog类和Cat类分别继承于Animal类,并重写Animal类中的抽象方法。 4.编写主类MainTest类 在主类MainTest类中的main方法中至少包含如下代码: Simulator simulator=new Simulator(); simulator.playSound(new Dog()); simulator.playSound(new Cat());

    应用编程题(共8分) 设计一个动物声音“模拟器”,希望模拟器可以模拟许多动物的叫声,要求如下: 1.编写抽象类Animal Animal抽象类有两个抽象方法cry()和getAnimalName(),即要求各种具体的动物给出自己的叫声和种类名称。 2.编写模拟器类Simulator 该类有一个playSound(Animal animal)方法,该方法的参数是Animal类型。即参数animal可以调用Animal的子类重写cry()方法播放具体动物的声音,调用子类重写的getAnimalName()方法显示动物种类的名称。 3.编写Animal类的子类:Dog和Cat类 Dog类和Cat类分别继承于Animal类,并重写Animal类中的抽象方法。 4.编写主类MainTest类 在主类MainTest类中的main方法中至少包含如下代码: Simulator simulator=new Simulator(); simulator.playSound(new Dog()); simulator.playSound(new Cat());

  • 2022-06-06 问题

    下列各种java类的定义,那种是错误的 A: class Animal{}class Dog extends Animal {} B: final class Animal{}class Dog extends Animal{} C: abstract class Animal{}class Dog extends Animal{} D: public class Animal{}class Dog extends Animal{}

    下列各种java类的定义,那种是错误的 A: class Animal{}class Dog extends Animal {} B: final class Animal{}class Dog extends Animal{} C: abstract class Animal{}class Dog extends Animal{} D: public class Animal{}class Dog extends Animal{}

  • 2022-06-07 问题

    Which animal is not the animal in Chinese Zodiac?

    Which animal is not the animal in Chinese Zodiac?

  • 2022-06-14 问题

    若Animal是Cat,Dog的父类,则下列选项中,正确的是() A: Animal animal = new Cat(); B: Cat cat = (Cat)new Animal(); C: Animal animal = new Dog(); D: Cat cat = (Cat)new Dog();

    若Animal是Cat,Dog的父类,则下列选项中,正确的是() A: Animal animal = new Cat(); B: Cat cat = (Cat)new Animal(); C: Animal animal = new Dog(); D: Cat cat = (Cat)new Dog();

  • 2022-06-14 问题

    若Animal是Cat,Dog的父类,则下列选项中,正确的是() A: Animal animal = new Cat(); B: Animal a = new Cat(); Cat cat = (Cat) a; C: Animal animal = new Dog(); D: Cat cat = (Cat)new Dog();

    若Animal是Cat,Dog的父类,则下列选项中,正确的是() A: Animal animal = new Cat(); B: Animal a = new Cat(); Cat cat = (Cat) a; C: Animal animal = new Dog(); D: Cat cat = (Cat)new Dog();

  • 2022-06-11 问题

    The muscles of a fossilized animal can sometimes be reconstructed because______. A: they were preserved with the rest of the animal B: they were lodged inside the animal's skull C: they were hardened parts of the animal's body D: they were attached to the animal's skeleton

    The muscles of a fossilized animal can sometimes be reconstructed because______. A: they were preserved with the rest of the animal B: they were lodged inside the animal's skull C: they were hardened parts of the animal's body D: they were attached to the animal's skeleton

  • 2021-04-14 问题

    class Animal { public Animal() { System.out.println("Animal!"); } } public class Dog extends Animal{ public Dog() { System.out.println("Dog!"); } public static void main(String[] args) { Dog dog=new Dog(); } }

    class Animal { public Animal() { System.out.println("Animal!"); } } public class Dog extends Animal{ public Dog() { System.out.println("Dog!"); } public static void main(String[] args) { Dog dog=new Dog(); } }

  • 2022-06-16 问题

    Many animal advocates oppose animal experimentation (vivisection) on ethical 4) ___

    Many animal advocates oppose animal experimentation (vivisection) on ethical 4) ___

  • 2021-04-14 问题

    (7-1)定义了Animal类、Cat类和Dog类,则代码段是正确的。 class Animal{ }; class Cat extends Animal{} class Dog extends Animal{}

    (7-1)定义了Animal类、Cat类和Dog类,则代码段是正确的。 class Animal{ }; class Cat extends Animal{} class Dog extends Animal{}

  • 1 2 3 4 5 6 7 8 9 10