Mögliche Duplizieren:
How come invoking a (static) method on a null reference doesn’t throw NullPointerException?Aufruf statische Methode in Java
Kann jemand erklären, warum die Ausgabe des folgenden Programms ist
public class Test4{
public static void method(){
System.out.println("Called");
}
public static void main(String[] args){
Test4 t4 = null;
t4.method();
}
}
" Called" Ich weiß, wir können statische Methode mit Klassenreferenz aufrufen, aber h Ich rufe mit Null-Referenz an. Bitte meine Zweifel