Question: What is the output of the following code lines: interface A { } class C { } class D extends C { } class B

What is the output of the following code lines:
interface A {
}
class C {
}
class D extends C {
}
class B extends D implements A {
}
public class Test {
public static void main(String[] args){ B
b = new B();
if (b instanceof A)
System.out.println("b is an instance of A"); if (b instanceof C)
System.out.println("b is an instance of C");}
}
Select one:
A. b is an instance of A followed by b is an instance of C.
B. b is an instance of C.
C. Nothing.
D. b is an instance of A.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!