The use of “this” in Java

后端 未结 13 1849
-上瘾入骨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:45

    Just like Robert Grant said, 'this' is how you make it clear that you are referring to a member variable instead of a local variable.

提交回复
热议问题