Code: Select all
public class Speak {
public static void main(String[] args) {
Speak s = new GoodSpeak();
INSERT CODE HERE
}
}
class GoodSpeak extends Speak implements Tone
{
public void up(){
System.out.println("UP UP UP");
}
}
interface Tone{
void up();
}
((Tone)s).up();
is not correct?
i assume that this code will have same result as
Code: Select all
Tone tone = ((Tone)s);
tone.up();
when i try this code i have same result "UP UP UP"
i think in this example was 2 right answer.