title: Use of "final" for method parameter in Java
body: <p>I read with interest this question :
  <a href="https://stackoverflow.com/questions/1068760/can-i-pass-parameters-by-reference-in-java">Can I pass parameters by reference in Java?</a></p>
  
  <p>What comes out it is that parameters (which are not primitives) are passed by copying the reference value.
  And so as the example states; you can't modify the reference of the parameter you gave:</p>
  
  <pre><code>Object o = "Hello";
  mutate(o)
  System.out.println(o); // Will print Hello
  
  private void mutate(Object o) { o = "Goodbye"; } //NOT THE SAME o!
  </code></pre>
  
  <p>This kind of problem could be avoided using <code>final</code>like this :</p>
  
  <pre><code>private void mutate(final Object o) { o = "Goodbye"; } //Compilation error
  </code></pre>
  
  <p>The questions : </p>
  
  <ul>
  <li>Is the <code>final</code> keyword in such a case only used to throw a compilation error ? </li>
  <li>If in the end you can't modify the reference of the given parameter why isn't <code>final</code> implicit or mandatory ?</li>
  </ul>
  
  <p>I rarely used <code>final</code> for method parameters in Java but now I can't think of any case where you would voluntarily omit to put <code>final</code> to a method parameter.</p>
  
  <p>Thanks!</p>