Oracle
1Z0-809 · Question #237
1Z0-809 Question #237: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #237. The question stem and answer options stay visible for context.
Question
Given:
interface Interface1 {
public default void sayHi() {
System.out.println("Hi Interface-1");
}
}
interface Interface2 {
public default void sayHi() {
System.out.println("Hi Interface-2");
}
}
public class MyClass implements Interface1, Interface2 {
public static void main(String[] args) {
Interface1 obj = new MyClass();
obj.sayHi();
}
public void sayHi() {
System.out.println("Hi MyClass");
}
}
What is the result?
Options
- AHi Interface-2
- BA compilation error occurs.
- CHi Interface-1
- DHi MyClass
Unlock 1Z0-809 to see the answer
You've previewed enough free 1Z0-809 questions. Unlock 1Z0-809 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.