Does this carry any meaning..... there is no object, how can there be a method in it. Static methods are shared by all instances. Also as static methods are class methods they can be called by using the class name.
[ SCJP 6.0 - 90% ] , JSP, Servlets and Learning EJB.
Try out the programs using a TextEditor. Textpad - Java 6 api
Compiler does allow it because it doesn't know anything about the object. All it checks is the reference type so it allows it. But as there is no object , its an exception. If this is what you meant.......a=null;a.nonstaticmethod() is also possible and allowed at compile..
Yeah checked it....i never came across this type.....it does work... and one more thing i din't read the question properly. Original code the method is not static and thus the null reference won't work. But yes thanks David..... Everthing we learn something new. Java is vast. Even if we know complex things, some simple things always pass by.