About Question com.enthuware.ets.scjp.v6.2.94 :
Posted: Tue Apr 10, 2012 1:45 pm
Hello, in the fifth option
class MidiPlayer implements MusicPlayer<Instrument> {
public void play(Guitar g){ }
}
the explanation says:
"Since MusicPlayer is typed to Instrument here, MidiPlayer must have a method play(Instrument)"
Is true that MusicPlayer is typed to Intrument, but in the exercise, MusicPlayer interface extends Player interface in RAW mode (without using generics).
interface MusicPlayer<E extends Instrument> extends Player{ }
So in practice i think that the correct explanations should be this:
"Since MusicPlayer is typed to Instrument here, MidiPlayer must have a method play(Object)"
So, but if you really wish maintain the explanation that exercise show, the interface Music Player should be fixed like this:
interface MusicPlayer<E extends Instrument> extends Player<E>{ }
The explanation in this case would be correct.
I hope I have explained correctly.
class MidiPlayer implements MusicPlayer<Instrument> {
public void play(Guitar g){ }
}
the explanation says:
"Since MusicPlayer is typed to Instrument here, MidiPlayer must have a method play(Instrument)"
Is true that MusicPlayer is typed to Intrument, but in the exercise, MusicPlayer interface extends Player interface in RAW mode (without using generics).
interface MusicPlayer<E extends Instrument> extends Player{ }
So in practice i think that the correct explanations should be this:
"Since MusicPlayer is typed to Instrument here, MidiPlayer must have a method play(Object)"
So, but if you really wish maintain the explanation that exercise show, the interface Music Player should be fixed like this:
interface MusicPlayer<E extends Instrument> extends Player<E>{ }
The explanation in this case would be correct.
I hope I have explained correctly.