Hello ,
I was just curious to understand how 'System.out.println' works in
java , I tried a code in java but it is giving me a run time exception
please tell me where i am wrong and rectify the code , if possible
___________________________________________________________________________
class prntstrm
{
public prntstrm()
{
System.out.println("Inside constructor prntstrm");
}
public void PRINTLN()
{
System.out.println("Inside prntstrm PRINTLN");
}
}
final class system
{
public static prntstrm OUT;
}
class demo
{
public static void main(
String arg[])
{
system.OUT.PRINTLN();
}
}
Exception is ---->
Exception in
thread "main" java.lang.NullPointerException
at demo.main(prt.java:28)
___________________________________________________________________________
One more thing (Can we call a static reference variable as an object , as here in this case , can we call OUT as an object of prntstrm
--------------------
regards
faisal