The use of “this” in Java

后端 未结 13 1926
-上瘾入骨i
-上瘾入骨i 2020-12-09 21:58

If I write the following class:

public class Example {

      int j;
      int k;

      public Example(int j, int k) {
           j = j;
           k = k;
          


        
13条回答
  •  [愿得一人]
    2020-12-09 22:37

    You might want to take a look at What is the advantage of having this/self pointer mandatory explicit?
    Although using this is not mandatory in Java as you noticed I'm sure it will shed some light on the subject of using this in Java as well.

提交回复
热议问题