Given:
What is the resulting output?
Method parameters named x and y shadow the instance fields. x = x changes only the parameter, while y = this.y assigns the instance field’s default value of 0 to the parameter. Neither field in the second object is changed, so the output is 100 200 : 0 0 :.
x
y
x = x
y = this.y
0
100 200 : 0 0 :
Community Discussion