What is the result?

Given:
4. class Example {
5. int x = 50;
6. int y = 100;
7. public static void main(String args[]) {
8. int x = 0, y = 10;
9. Example ex = new Example();
10. while (x < 3) {
11. x++; y–;
12. }
13. System.out.println(“x = ” + x + ” , y = ” + y);
14. }
15. }

What is the result?

Given:
4. class Example {
5. int x = 50;
6. int y = 100;
7. public static void main(String args[]) {
8. int x = 0, y = 10;
9. Example ex = new Example();
10. while (x < 3) {
11. x++; y–;
12. }
13. System.out.println(“x = ” + x + ” , y = ” + y);
14. }
15. }

What is the result?

A.
Compilation fails because of an error at line 10.

B.
Compilation fails because of an error at line 8.

C.
x = 53 , y = 97

D.
Compilation fails because of an error at line 9.

E.
Compilation fails because of an error at line 11.

F.
x = 3 , y = 7



Leave a Reply 0

Your email address will not be published. Required fields are marked *