title: Why it is not possible to call a static function defined within a class through reference variable of the class?
body: <p>I have a question that why this code is giving me an error while i am trying to call a static function defined within a class through a class reference and it makes possible to call a static function when i am creating an object of a reference.</p>
  
  <pre><code>public class Example
  {
  public static void main(String args[])  
  {
  Example t;
  t.method();//getting error
  Example t1=new Example t1();
  t1.method();//it runs successfully
  }
  public static void method()
  {
  System.out.println("NullPointerException");
  }
  }
  </code></pre>