Which three lines will compile and output “right on!”?

Given:
public class Speak { /* Line 1 */
public static void main(String[] args) { /* Line 2 */
Speak speakIT = new Tell(); /* Line 3 */
Tell tellIt = new Tell(); /* Line 4 */
speakIT.tellItLikeItIs(); /* Line 5 */
(Truth)speakIt.tellItLikeItIs(); /* Line 6 */
((Truth)speakIt).tellItLikeItIs(); /* Line 7 */
tellIt.tellItLikeItIs(); /* Line 8 */
(Truth)tellIt.tellItLikeItIs(); /* Line 9 */
((Truth)tellIt).tellItLikeItIs(); /* Line 10 */
}
}
class Tell extends Speak implements Truth {

public void tellItLikeItIs() {
System.out.println(“Right on!”);
}
}
interface Truth { public void tellItLikeItIs()};
Which three lines will compile and output “right on!”?

Given:
public class Speak { /* Line 1 */
public static void main(String[] args) { /* Line 2 */
Speak speakIT = new Tell(); /* Line 3 */
Tell tellIt = new Tell(); /* Line 4 */
speakIT.tellItLikeItIs(); /* Line 5 */
(Truth)speakIt.tellItLikeItIs(); /* Line 6 */
((Truth)speakIt).tellItLikeItIs(); /* Line 7 */
tellIt.tellItLikeItIs(); /* Line 8 */
(Truth)tellIt.tellItLikeItIs(); /* Line 9 */
((Truth)tellIt).tellItLikeItIs(); /* Line 10 */
}
}
class Tell extends Speak implements Truth {

public void tellItLikeItIs() {
System.out.println(“Right on!”);
}
}
interface Truth { public void tellItLikeItIs()};
Which three lines will compile and output “right on!”?

A.
Line 5

B.
Line 6

C.
Line 7

D.
Line 8

E.
Line 9

F.
Line 10



Leave a Reply 1

Your email address will not be published. Required fields are marked *


Kurt

Kurt

The correct answer is CDF