A.Animalanimal=newCat()
B.Catcat=(Cat)newDog()
C.Catcat=(Cat)newAnimal()
D.Animalanimal=newDog()
第1题:
基于前面的在线编程作业改写 Dog类和Cat类继承Animal类 根据用户输入的数值,创建相应个数的 Dog 对象和 Cat对象,然后调用 speak() 之后再销毁。
第2题:
若有父类Animal及其两个子类Cat、Dog,则以下类型转换正确的有()
A.Cat cat = (Cat)new Animal();
B.Animal a = new Cat(); Cat cat = (Cat) a;
C.Animal animal = new Cat();
D.Animal a = new Dog(); Cat cat = (Cat) a;
第3题:
1、在前面几题的基础上,有子类Dog和Cat继承了父类Animal,如下空格的输出是以下哪个选项? dog = Dog('coco','small'); cat = Cat('kawaii') >>> isinstance(dog, Animal) ___________ >>> isinstance(cat, Animal) ___________ >>> isinstance(dog, Dog) ___________ >>> isinstance(dog, Cat) ____________
A.True True False False
B.True True True False
C.True False False True
D.True True True True
第4题:
在前面几题的基础上,有子类Dog和Cat继承了父类Animal,如下空格的输出是以下哪个选项? dog = Dog('coco','small'); cat = Cat('kawaii') >>> isinstance(dog, Animal) ___________ >>> isinstance(cat, Animal) ___________ >>> isinstance(dog, Dog) ___________ >>> isinstance(dog, Cat) ____________
A.True True False False
B.True True True False
C.True False False True
D.True True True True
第5题:
【单选题】(7-1)定义了Animal类、Cat类和Dog类,则()代码段是正确的。 class Animal{ }; class Cat extends Animal{} class Dog extends Animal{}
A.Dog[] a = new Dog[5]; a[0] = new Cat();
B.Animal a = new Animal[5]; a[0] = new Animal();
C.Dog[]a = new Dog[5]; a[0] = new Animal();
D.Cat[]a = new Cat[5]; a[0] = new Cat();