Oracle
1Z0-803 · Question #254
1Z0-803 Question #254: Real Exam Question with Answer & Explanation
The correct answer is C: 100 200 : 100 0 :. See the full explanation below for the reasoning.
Question
Given: public class TestField { int x; int y; public void doStuff(int x, int y) { this.x = x; y =this.y; } public void display() { System.out.print(x + " " + y + " : "); } public static void main(String[] args) { TestField m1 = new TestField(); m1.x = 100; m1.y = 200; TestField m2 = new TestField(); m2.doStuff(m1.x, m1.y); m1.display(); m2.display(); } } What is the result?
Options
- A100 200 : 100 200
- B100 0 : 100 0 :
- C100 200 : 100 0 :
- D100 0 : 100 200 :
Community Discussion
No community discussion yet for this question.