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.
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");
}
}