且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ArrayList 空指针异常

更新时间:2023-11-29 18:41:22

ArrayList<PeopleDetails> people_selected;

您声明并从未初始化.只需在使用前初始化它.否则 NullPointerException.

You declared and never initialized. Just initialize it before using it. Otherwise NullPointerException.

尝试初始化

ArrayList<PeopleDetails> people_selected= new ArrayList<PeopleDetails>();