V

Vikash Gupta • 33.56K Points
Instructor I

Q. What will be the output?
interface A{
public void method1();
}
class One implements A{
public void method1(){
System.out.println("Class One method1");
}
}
class Two extends One{
public void method1(){
System.out.println("Class Two method1");
}
}
public class Test extends Two{
public static void main(String[] args){
A a = new Two();
a.method1();
}
}

  • (A) Compilation Error
  • (B) Class One method1
  • (C) Class Two method1
  • (D) Class Two method1 D. Throws a NoSuchMethodException at runtime.
  • Correct Answer - Option(C)
  • Views: 60
  • Filed under category JAVA

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics