title: static variable in subclass Java
body: <p>I need to have a static variable that is not related to an object, but to the class itself. However, the variable must also not be related to the parent class, or all other sub-classes that extends the same parent class.</p>
  
  <p>let's say:</p>
  
  <pre><code>    class Army{
        static int attack = 0;
      }
  
      class Warrior extends Army{
        public Warrior(){ 
          attack = 50;   // every Warrior object will have attack value of 50
        }
      }
  
      class Archer extends Army{
         public Archer(){ 
           attack = 75; // every Archer object will have attack value of 75
         }
      }
  </code></pre>
  
  <p>Is it possible? Or do I need to declare the static variable in each subclass?  I've tried and when I tried to access the static variable, the static variable's value ended up the same for every class.</p>