title: Best practice for parameter naming in Java constructors and simple setters
body: <p>Is there a standard acceptable convention for parameters in <strong>Java</strong> to straightforward constructors and setters? </p>
  
  <p>(<a href="https://stackoverflow.com/questions/450866/naming-convention-for-params-of-ctors-and-setters">I've seen the answer for C++</a>, but practices are often different between the two communities)</p>
  
  <p>Suppose that I have a class C with a foo field.</p>
  
  <p>I have commonly seen the following three options:</p>
  
  <h2>1) Use the actual field name with an underscore:</h2>
  
  <pre><code>public C(Type foo_)
  {
     foo = foo_;
  }
  
  public void setFoo(Type foo_)
  {
     foo = foo_;
  }
  </code></pre>
  
  <h2>2) Use the actual field name, just use "this" in setting:</h2>
  
  <pre><code>public C(Type foo)
  {
     this.foo = foo;
  }
  public void setFoo(Type foo)
  {
     this.foo = foo;
  }
  </code></pre>
  
  <h2>3) Completely inconsistent things like:</h2>
  
  <pre><code>public C(Type bar)
  {
     this.foo = bar;
  }
  public void setFoo(Type bar)
  {
     this.foo = bar;
  }
  </code></pre>
  
  <p>I tend to use 2, but I'm wondering what's correct practice. </p>