Question 191 · 200 in bank
Given:

What is the result?
Show answer
Answer: A
Explanation
The correct is A, because m2 object variables x and y are not assigned so, these have default zero values. so the answer is 100:200:0:0 and you can test the code: public class MyField { int x; int y; public void doStuffy(int x, int y) { x = x; y = this.y; } public void display () { System.out.print(x + " " + y + " : "); } public static void main(String[] args) { MyField m1 = new MyField (); m1.x = 100; m1.y = 200; MyField m2 = new MyField(); m2.doStuffy(m1.x, m1.y); m1.display(); m2.display(); } }
Source: Adapted from community discussion — iSnover
