title: Difference between a static and a final static variable in Java
body: <p>Generally, final static members especially, variables (or static final of course, they can be used in either order without overlapping the meaning) are extensively used with interfaces in Java to define a <strong>protocol behavior</strong> for the implementing class which implies that the class that implements (inherits) an interface must incorporate all of the members of that interface. </p>
  
  <hr>
  
  <p>I'm unable to differentiate between a <strong>final</strong> and a <strong>final static</strong> member. The final static member is the one which is a static member declared as final or something else? In which particular situations should they be used specifically?</p>
  
  <hr>
  
  <p>A static variable or a final static variable can never be declared inside a method neither inside a static method nor inside an instance method. Why?</p>
  
  <p>The following segment of code accordingly, will not be compiled and an compile-time error will be issued by the compiler, if an attempt is made to compile it.</p>
  
  <pre><code>public static void main(String args[])
  {
      final int a=0;  //ok
  
      int b=1;  //ok
  
      static int c=2;  //wrong
  
      final static int x=0;  //wrong
  }
  </code></pre>