Possible Duplicate:
What happens when a static method is invoked using a null object reference?
I'm curious as to how - and why - this behavior is implemented:
If I hold a null pointer to a class that has a static function, {nullPointer}.doSomething() will still work! for example, running the following example will not result in a null pointer exception!
How come is this even possible?
Class A {
int a;
static void doSomething() {...}
}
Class B {
void test() {
A a = null;
//This will not throw an exception!
a.doSomething();
}
}