title: Compilation error is stating the instance method as a static context (Java 6)
body: <p>method2() is defined as an instance in class StaticVar. Having been aware that in method2()'s context, num still doesn't have memory allocation in class Test's object. I'm getting an error that method2() is static although I didn't include static modifier</p>
  
  <ol>
  <li>With making method2() as static, it compiles fine</li>
  <li>With an object reference in method2() for class Test it compiles fine </li>
  <li><p>But upon error, why is it being treated as static?</p>
  
  <pre><code>class Test 
  {
      int num = 55;
  
      static void method1()
      { Test t2 = new Test(); System.out.println("m1 num "+t2.num);}
  }
  
  class StaticVar
  {
      void method2()
      {  System.out.println("m2 num "+Test.num);}  //error here
  
      public static void main(String []args)
      {
          StaticVar sv = new StaticVar();
          Test.method1();
          sv.method2();
      }
  }
  </code></pre></li>
  </ol>
  
  <p>Got this compilation result:</p>
  
  <blockquote>
    <p>D:\JavaEx>javac StaticVar.java StaticVar.java:12: non-static variable
    num cannot be referenced from a static context</p>
    
    <p>{  System.out.println("m2 num "+Test.num);}</p>
  </blockquote>