Oracle
1Z0-809 · Question #119
1Z0-809 Question #119: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #119. The question stem and answer options stay visible for context.
Question
Given:
package p1;
public interface DoInterface {
void m1(int n);
public void m2(int n);
}
package p3;
import p1.DoInterface;
public class DoClass implements DoInterface {
int x1, x2;
DoClass() {
this.x1 = 0;
this.x2 = 10;
}
public void m1(int p1) { x1+=p1; System.out.println(x1); } // line n2
public void m2(int p1) { x2+=p1; System.out.println(x2); }
}
package p2;
import p1.;
import p3.;
class Test {
public static void main(String[] args) { // line n3
DoInterface doi = new DoClass();
doi.method1(100);
doi.method2(200);
}
}
What is the result?
Options
- A100
- BCompilation fails due to an error in line n1
- CCompilation fails due to an error at line n2
- DCompilation fails due to an error at line n3
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.