OCPJP 6, OCMJD
Alexander Shrago wrote:Chapter 2 Question 14 is
"You’re designing a new online board game in which Floozels are a type of Jammers, Jammers can
have Quizels, Quizels are a type of Klakker, and Floozels can have several Floozets. Which of the
following fragments represent this design?"
I get that you mean, but
where are no words "IS-A" or "HAS-A"
"HAS-A" relationships can appear later during realization
Where am I wrong?
Tell the difficulties that i am difficult.
Alexander Shrago wrote:
So answer "D" is also correct inspite of authors opinion:
import java.util.*;
interface Jammer extends Quizel { }
interface Klakker { }
interface Quizel extends Klakker { }
interface Floozel extends Jammer, Floozet { }
interface Floozet { }
Checking it:
floozels are a type of Jammers - yes
quizels are a type of Klakker - yes
Jammers can have Quizels and Floozels can have several Floozets - Where do you see that they can not ??
Alexander Shrago wrote:
Am I wrong?
Glen Iris wrote:You're designing a new online board game in which Floozels are a type of Jammers, Jammers can have Quizels, Quizels are a type of Klakker, and Floozels can have severl Floozets. Which of the following fragments represent this design? (choose all that apply)
The correct answers are given as A and C.
A.
C.
Given that Floozels can have several Floozets, this implies that Floozet is an instance variable. A shows it as an interface and C shows it as an instance variable.
Looking forward to your help as always :-)
Guilherme Bazilio wrote:
Java does not support multiple inheritance! So answer D is false!
Alexander Shrago wrote:
Guilherme Bazilio wrote:
Java does not support multiple inheritance! So answer D is false!
There are no problem for an interface to extend many interfaces. Check it!
I'm not dead! I feel happy! I'd like to go for a walk! I'll even read a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|