Oracle
1Z0-809 · Question #82
1Z0-809 Question #82: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #82. The question stem and answer options stay visible for context.
Question
Given:
class Test {
int sum = 0;
public void doCheck(int number) {
if (number % 2 == 0) {
break;
} else {
for (int i = 0; i < number; i++) {
sum += i;
}
}
}
public static void main(String[] args) {
Test obj = new Test ();
System.out.println("Red " + obj.sum);
obj.doCheck(2);
System.out.println("Orange " + obj.sum);
obj.doCheck(3);
System.out.println("Green " + obj.sum);
}
}
What is the result?
Options
- ARed 0 Orange 0 Green 3
- BRed 0 Orange 0 Green 6
- CRed 0
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.