Can someone explain to me in detail the use of 'this'?

后端 未结 9 1978
北海茫月
北海茫月 2021-01-24 21:51

I don\'t really understand the use of \'this\' in Java. If someone could help me clarify I would really appreciate it.

On this website it says: http://docs.oracle.com/ja

9条回答
  •  时光说笑
    2021-01-24 22:30

    It isn't this.x = a because there isn't an 'a' in the second example. The point is that you can reuse the same variable name, which is less confusing :-|

提交回复
热议问题