Oracle
1Z0-850 · Question #35
Given: 1. class Example { 2. int x = 50; 3. int y = 100; 4. public static void main(String args[]) { 5. int x = 0, y = 10; 6. Example ex = new Example(); 7. while (x < 3) { 8. x++; y--; 9. } 10…
Sign in or unlock 1Z0-850 to reveal the answer and full explanation for question #35. The question stem and answer options stay visible for context.
Question
Given:
- class Example {
- int x = 50;
- int y = 100;
- public static void main(String args[]) {
- int x = 0, y = 10;
- Example ex = new Example();
- while (x < 3) {
- x++; y--;
- }
- System.out.println("x = " + x + ", y = " + y);
- }
- } What is the result?
Options
- ACompilation fails because of an error at line 8.
- Bx=3, y=7
- CCompilation fails because of an error at line 11.
- DCompilation fails because of an error at line 9.
- Ex=53, y=87
- FCompilation fails because of an error at line 10.
Unlock 1Z0-850 to see the answer
You've previewed enough free 1Z0-850 questions. Unlock 1Z0-850 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.