Oracle
1Z0-809 · Question #159
Given the code fragment: public class Test { static int count = 0; int i = 0; public void changeCount() { while (i < 5) { count++; i++; } } public static void main(String[] args) { Test check1 = new…
The correct answer is A. 10 : 10. You've hit your session limit · resets 10:20pm (America/New_York)
Question
Given the code fragment:
public class Test {
static int count = 0;
int i = 0;
public void changeCount() {
while (i < 5) {
count++;
i++;
}
}
public static void main(String[] args) {
Test check1 = new Test();
Test check2 = new Test();
check1.changeCount();
check2.changeCount();
System.out.print(check1.count + ":" + check2.count);
}
}
What is the result?
Options
- A10 : 10
- B5 : 10
- CCompilation fails.
- D5 : 5
How the community answered
(53 responses)- A83% (44)
- B9% (5)
- C2% (1)
- D6% (3)
Explanation
You've hit your session limit · resets 10:20pm (America/New_York)
Community Discussion
No community discussion yet for this question.