title: Java static variable in method overriding
body: <p>I have a code in which I expect the output to be different from the actual output.. As static variables are reference based, I expect the output to be "superclass" but what I am getting is "subclass".. Code:</p>
  
  <pre><code>class TestClass {
      public static void main(String args[] ) throws Exception {
          A b = new B(); // Since the reference is A, "superclass" should be the output
          b.test();
      }
  }
  abstract class A{
      static String a = "superclass";
      abstract void test();
  }
  class B extends A{
      static String a = "subclass";
      void test(){
          System.out.println(a); // Output subclass
      }
  }
  </code></pre>
  
  <p>Please tell me where am I wrong..</p>