title: Accessing Static variable from one class to another but getting incorrect value
body: <p>This is my first question on stackoverflow,</p>
  
  <p>I want to access <strong>static int variable</strong> of one class in another class but when i access this variable in another class it always gives me <strong>"zero"</strong>.</p>
  
  <p><strong>This is First class</strong>:</p>
  
  <pre><code>package kk;
  
  public class ag {
      public static int n=0;
  
      public static int as()
      {
          return n;
      }
      public static void main(String[] args) {
          // TODO Auto-generated method stub
  
          n=3;
          n=n*5;
          System.out.println(n);
      }
  
  
  }
  </code></pre>
  
  <p>Here the output is 15 i.e. n=15 here.</p>
  
  <p><strong>Second class:</strong></p>
  
  <pre><code>package kk;
  
  public class ah extends ag {
  
      public static void main(String[] args) {
          // TODO Auto-generated method stub
          //ag aa =new ag();
  int k =ag.as();
  System.out.println(k);
      }
  
  }
  </code></pre>
  
  <p>In this am trying to access the static variable n from First class but getting 0 as output but i want 15. </p>