Solved

Show the Output of Running the Class Test in the Following

Question 3

Multiple Choice

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

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents