Sail E0 Webinar
Question
Determine output of the following code.
interface A { }
class C { }
class D extends C { }
class B extends D implements A { }
public class Test extends Thread{
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");
}
}
Options:
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.
Answer: Option D

Submit Your Solution Below and Earn Points !
Next Question

Submit Solution

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

More Questions on This Topic :


Latest Videos

Latest Test Papers