Single Choice Not Set

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

ID: #2280 Java Interfaces And Abstract Classes MCQ 2,257 views
Question Info
#2280Q ID
Not SetDifficulty
Java Interfaces And Abstract Classes MCQTopic

Choose the Best Option

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

  • A will print Class One method
  • B will print Class Two method
  • C compiles fine but print nothing
  • D Compilation Error
Correct Answer

Explanation

will print Class Two method

Share This Question

Challenge a friend or share with your study group.