Oracle
1Z0-809 · Question #164
Given the code fragments: interface Exportable { void export(); } class Tool implements Exportable { public void export() { System.out.println("Tool::export"); } } class ReportTool extends Tool…
The correct answer is B. Compilation fails only at line n1. You've hit your session limit · resets 10:20pm (America/New_York)
Question
Given the code fragments:
interface Exportable {
void export();
}
class Tool implements Exportable {
public void export() {
System.out.println("Tool::export");
}
}
class ReportTool extends Tool implements Exportable {
public void export() {
System.out.println("RTool::export"); // line n1
}
public static void main(String[] args) {
Tool atool = new ReportTool();
Tool btool = new Tool();
Exportable ctool;
callExport(btool);
}
public static void callExport(Exportable ex) {
ex.export(); // line n2
}
}
What is the result?
Options
- ACompilation fails at both line n1 and line n2.
- BCompilation fails only at line n1.
- CCompilation fails only at line n2.
- DToo1 :: export Too1 :: export
- ERToo1 :: export Too1 :: export
How the community answered
(32 responses)- A6% (2)
- B81% (26)
- C9% (3)
- D3% (1)
Explanation
You've hit your session limit · resets 10:20pm (America/New_York)
Community Discussion
No community discussion yet for this question.