摘要:
所谓空指针异常就是当对象为null时,调用了它的属性或者方法,就会报NullPointerExceptionpackage test;public class Test { public String test = "abd"; public void test(){ System.out.println("test"); } public static void main(String[] args) { Test t = null; System.out.println(t.test); t.test(); }}结果如下:Exception in t 阅读全文