title: What is the difference between Class.this and this in Java
body: <p>There are two ways to reference the instance of a class within that class. For example:</p>
  
  <pre><code>class Person {
    String name;
  
    public void setName(String name) {
      this.name = name;
    }
  
    public void setName2(String name) {
      Person.this.name = name;
    }
  }
  </code></pre>
  
  <p>One uses <code>this.name</code> to reference the object field, but the other uses <code>className.this</code> to reference the object field. What is the difference between these two references?</p>