1Z1-803 無料問題集「Oracle Java SE 7 Programmer I」
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?
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?
正解:D
解答を投票する