1.下标越界异常:
错误示例:String comType = componentList.get(0).getComponentType();
错误原因:该初始化语句是由于一上来取值,而造成的错误,因为list集合,很有可能没有一条记录
解决办法:对list集合进行判空处理
if (componentList.size()!=0){
comType = componentList.get(0).getComponentType();
}
代码-下标越界异常
最新推荐文章于 2024-08-08 14:16:47 发布