この動作がどのように、そしてなぜ実装されているのか興味があります。
静的関数を持つクラスへの null ポインターを保持している場合でも、 {nullPointer}.doSomething() は機能します! たとえば、次の例を実行しても、null ポインター例外は発生しません。
なぜこれが可能なのですか?
Class A {
int a;
static void doSomething() {...}
}
Class B {
void test() {
A a = null;
//This will not throw an exception!
a.doSomething();
}
}