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? (Choose three.)
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
-------------------------------------------------------------------------------------
答案:BCF
參考:6-5 繼承
A. Cat is-a Animal //題目中Cat和Animal沒任何關係
B. Cat is-a Jumper //Cat是Jumper的子類別 50. class Cat implements Jumper{
C. Dog is-a Animal //Dog和Animal 是父子關關 30. class Dog extends Animal{
D. Dog is-a Jumper //題目中Dog和Jumper沒任何關係
E. Cat has-a Animal //題目中 Cat的屬性中沒有任何一類別為Animal 51. public void jump(){}
F. Beagle has-a Tail //看起來Beagle沒有Tail的屬性,可是Beagle繼承Dog,Dog有Tail的屬性所以等同Beagle有Tail
G. Beagle has-a Jumper //題目中Beagle沒有Jumper的屬性
沒有留言:
張貼留言