Solved

Show the Output of Running the Class Test in the Following

Question 14

Multiple Choice

Show the output of running the class Test in the following code: interface A {
Void print() ;
}
Class C {}
Class B extends C implements A {
Public void print() { }
}
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") ;
}
}


A) Nothing.
B) b is an instance of A.
C) b is an instance of C.
D) b is an instance of A followed by b is an instance of C.

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions