A、A.Cat cat = (Cat)new Animal();
B、B.Animal a = new Cat(); Cat cat = (Cat) a;
C、C.Animal animal = new Cat();
D、D.Animal a = new Dog(); Cat cat = (Cat) a;
第1题
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();
第2题
设计一个动物声音“模拟器”,希望模拟器可以模拟许多动物的叫声。要求如下: 1)编写抽象类Animal Animal抽象类有2个抽象方法cry()和getAnimaName(),即要求各种具体的动物给出自己的叫声和种类名称。 2)编写模拟器类Simulator 该类有一个playSound(Animal animal)方法,该方法的参数是Animal类型。即参数animal可以调用Animal的子类重写的cry()方法播放具体动物的声音、调用子类重写的getAnimalName()方法显示动物种类的名称。 3)编写Animal类的子类:Dog,Cat类 Dog中重写的cry()方法实现在控制台输出“bow-wow”,及其getAnimalName()方法实现输出“Dog”; Cat中重写的cry()方法实现在控制台输出“miaow”,及其getAnimalName()方法实现输出“Cat”。 4)编写主类Application(用户程序) 在主类Application的main方法中至少包含如下代码: Simulator simulator = new Simulator(); simulator.playSound(new Dog()); simulator.playSound(new Cat()); 注:此题中每个类的代码量均在3~5行左右,不复杂。
第3题
A. fscanf(dog ,2,1,fp);
B. fscanf(fp,"%d%d",&dog ,&cat);
C. fscanf(dog ,cat,2,1,fp);
D. fscanf(fp,"%d",&dog ,&cat);
第5题
第6题
A、True True False False
B、True True True False
C、True False False True
D、True True True True
第7题
A. hypernym
B. synonym
C. homonym
D. hyponyms
第9题
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!