Oracle
1Z0-809 · Question #145
1Z0-809 Question #145: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #145. The question stem and answer options stay visible for context.
Question
class Alpha {
int ns;
static int s;
Alpha(int ns) {
if (s == ns)
this.ns = ns;
}
void doPrint() {
System.out.println("ns = " + ns + " s = " + s);
}
}
And,
public class TestA {
public static void main(String[] args) {
Alpha ref1 = new Alpha(50);
Alpha ref2 = new Alpha(125);
Alpha ref3 = new Alpha(100);
ref1.doPrint();
ref2.doPrint();
ref3.doPrint();
}
}
What is the result?
Options
- Ans = 50 s = 50 ns = 125 s = 125 ns = 100 s = 100
- Bns = 50 s = 125 ns = 125 s = 125 ns = 0 s = 125
- Cns = 50 s = 125 ns = 125 s = 125 ns = 100 s = 125
- Dns = 50 s = 50 ns = 125 s = 125 ns = 0 s = 125
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.