javaSE不可忽视的地方000001

public class test1 {

 public void test(String str){   System.out.print(str);

 }

 public static void main(String[] args) {   

test1 t = new test1();   

t = null;  

 t.test("abc");  }

}

 

能通过编译,不能运行的会报错的哦!

Exception in thread "main" java.lang.NullPointerException
 at com.test.test1.main(test1.java:10)

posted @ 2013-04-25 23:57  tom0  阅读(112)  评论(0)    收藏  举报