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: #2256 Inheritance in Java MCQ 2,506 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

Explanation

Class One method1
Today: 0 answered · 0 correct
Save progress
Free account

Want to remember what you got wrong?

Create a free account in seconds to track your score, revisit mistakes and continue Programming Language where you left off.

  • Save your progress & streak
  • Topic-wise quizzes & scores
  • Bookmark tricky questions
  • Printable MCQ sets
Practice smarterFree account · save progress
Sign up free

Share This Question

Challenge a friend or share with your study group.