πŸ“Š JAVA
Q. 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");
}
}
  • (A) Nothing.
  • (B) This code will not compile, because class Dog must implement method doYourJob() from interface Guard.
  • (C) ---
  • (D) ---
πŸ’¬ Discuss
βœ… Correct Answer: (D) ---

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
92
Total Visits
πŸ“½οΈ
12 mo ago
Published
πŸŽ–οΈ
Rakesh Kumar
Publisher
πŸ“ˆ
81%
Success Rate