可能重复:
How come invoking a (static) method on a null reference doesn’t throw NullPointerException?调用静态方法在Java中
任何一个可以解释为什么以下程序的输出为 “叫”
public class Test4{
public static void method(){
System.out.println("Called");
}
public static void main(String[] args){
Test4 t4 = null;
t4.method();
}
}
我知道我们可以用类引用调用静态方法,但是h在我使用空引用调用之前。请澄清我的疑问