title: How and where to use Static modifier in Java?
body: <p>How and where should we use a Static modifier for: </p>
  
  <p><strong>1. Field and<br>
  2. Method?</strong></p>
  
  <p>For <a href="http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Math.html" rel="nofollow noreferrer">example</a> in <code>java.lang.Math</code> class, the fields methods like abs(), atan(), cos() etc are static, i.e. they can be accessed as: <code>Math.abs()</code></p>
  
  <p>But why is it a good practice?</p>
  
  <p>Say, I don't keep it static and create an object of the class and access it, which anyways I can, I will just get a warning that, you are trying to access a static method in a non static way (as pointed out by @duffymo, not in case of Math class).</p>
  
  <p><strong>UPDATE 1:</strong></p>
  
  <p>So, utility method, should be static, i.e. whose work is only dependent on the method parameters. So, for example, can the method <code>updateString(String inputQuery, String highlightDoc)</code> should have been a static method in <a href="https://stackoverflow.com/questions/3939561/how-can-this-java-code-be-improved-to-find-sub-string-in-a-string">this question</a>?</p>