Oracle
1Z0-809 · Question #152
1Z0-809 Question #152: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #152. The question stem and answer options stay visible for context.
Question
Given:
class C2 {
public void displayC2() {
System.out.println("C2");
}
}
interface I {
public void display();
}
class C1 extends C2 implements I {
public void display() {
System.out.println("C1");
}
}
And given the code fragment:
C2 obj1 = new C1();
I obj2 = new C1();
C2 s = obj1;
I t = obj2;
s.display();
t.displayC2();
What is the result?
Options
- AC2C2
- BC1C2
- CC1C1
- DCompilation fails.
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.