Oracle
1Z0-809 · Question #52
1Z0-809 Question #52: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #52. The question stem and answer options stay visible for context.
Question
Given:
class Alpha {
int ns;
static int S;
Alpha (int ns) {
if (S < ns) {
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 refl = new Alpha(50);
Alpha ref2 = new Alpha(125);
Alpha ref3 = new Alpha(100);
refl.doPrint();
ref2.doPrint();
ref3.doPrint();
}
}
What is the result?
Options
- Ans = 50 S = 125 ns = 125 S = 125 ns = 100 S = 125
- Bns = 50 S = 125 ns = 125 S = 125 ns = 0 S = 125
- Cns = 50 S = 50 ns = 125 S = 125 ns = 100 S = 100
- 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.