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) Class One method1
  • (B) Class Two method1
  • (C) Nothing will be printed
  • (D) Compilation Error
πŸ’¬ Discuss
βœ… Correct Answer: (B) Class Two method1

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
136
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Ravi Shankar
Publisher
πŸ“ˆ
98%
Success Rate