Single Choice 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: #2238 Overriding and Overloading in Java 1,174 views
Question Info
#2238Q ID
Not SetDifficulty
Overriding and Overloading in JavaTopic

Choose the Best Option

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

  • A Class One method1
  • B Class Two method1
  • C Nothing will be printed
  • D Compilation Error
Correct Answer

Explanation

Class Two method1

Share This Question

Challenge a friend or share with your study group.

Related MCQ Questions