java中使用for遍历集合是注意的空指针异常 public static void main(String[] args) { List<Object> a = null; for(Object i : a)//会有空指针异常 { } }