List.AddAll的NullPointerException

错误:

在list中使用addAll()添加一个list时,报空指针异常

List entitys= null;

后来改为

List entitys= new ArrayList<>();

原因:

只在栈中有引用而在堆中没有分配到内存空间

猜你喜欢

转载自blog.csdn.net/weixin_52255395/article/details/130550572