Question: Which statement is true about the following code? Select the one correct answer. (a) The program will not compile. (b) The program will throw a

Which statement is true about the following code?

interface InterfaceA { void do It(); } interface InterfaceB extends InterfaceA {}

Select the one correct answer.

(a) The program will not compile.

(b) The program will throw a ClassCastException.

(c) The program will print: Jingle|Jingle|Jazz|Jingle|

(d) The program will print: Jingle|Jazz|Jingle|Jingle|

(e) The program will print: Jingle|Jingle|Jingle|Jazz|

interface InterfaceA { void do It(); } interface InterfaceB extends InterfaceA {} interface InterfaceC extends InterfaceB { } class Beta implements InterfaceB { public void doIt () { System.out.print("Jazz"); } void doIt (); boolean equals (Object obj); } } public class RQ12A999 { public static void main(String[] args) { InterfaceA a = () -> System.out.print("Java"); InterfaceB b = () -> System.out.print("Jive!"); InterfaceC c = () -> System.out.print ("Jingle | "); Object o = a = c; b = new Beta (); a.doIt (); b.doIt (); c.doIt (); ((InterfaceA) o).doIt (); }

Step by Step Solution

3.35 Rating (161 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

d The three interfaces are functional interfaces InterfaceB explicitly provides an abstract method d... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Programming 8th Questions!