ExamVeda
Login
Home
Interfaces and Abstract Classes
?

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");
        }
}

Answer & Solution
Correct Answer: Option D
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

1 Comment
Vinayak Kedia
Vinayak Kedia 9 years ago
yes