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();
}
}
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
iSnover
Highly Voted 1 year, 2 months agocarloswork
1 year, 1 month agoAhmadTechie
Most Recent 2 weeks, 6 days agoDarGrin
2 months agowinfred_lu
5 months, 1 week agoKolodets
7 months, 3 weeks agoVicky_65
8 months, 1 week agoodzio33
9 months, 4 weeks agoRajeevkuamr
11 months, 1 week agoRajeevkuamr
11 months, 1 week agohaisaco
11 months, 3 weeks agoakbiyik
1 year agocarloswork
1 year, 1 month agoJoker74
1 year, 3 months agoshivkumarx
1 year, 2 months ago