This is simple as well tricky.
It is printing true because of the static block. It will execute when the class is first referenced.
Now, as you might have already noticed, processorA always returns null, still processorB is getting called (without NullPointerException).
This is because processorB is a static method and the compiler knows that processorA returns an object of class Q1 which has a static method processorB. But as calls to static methods depend only on the class of object reference (as opposed to instance method, where it depends on actual class of object), the compiler binds the call to processorB().
The point is, it does not wait till runtime to bind the call. So, it does not need any object. So, there is no nullpointer!
HTH,
Paul.
------------------
Get Certified, Guaranteed!
(Now Revised for the new
Pattern)
www.enthuware.com/jqplus
Try out the world's only WebCompiler!
www.jdiscuss.com [This message has been edited by Paul Anil (edited March 27, 2001).]