MCQ Single Best Answer Not Set

QWhat 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();
	}
}

ID: #2256 Inheritance in Java MCQ 2,454 views
Question Info
#2256Q ID
Not SetDifficulty
Inheritance in Java MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A Compilation Error
  • B Class One method1
  • C Class One method1
  • D Throws a NoSuchMethodException at runtime.
Correct Answer: Option C

Explanation

Class One method1

Share This Question

Challenge a friend or share with your study group.