java:java.lang.NullPointerException: null 装箱拆箱引发的空指针异常

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/pulong0748/article/details/81702381

这里写图片描述
这里写图片描述
解决思路:首先根据报错定位到关键的一句话

list<charginPileVO>......

然后断点,并且将这句话 add to watch 会出现真正的异常:java.lang.NullPointerException: cannot unbox null value
是因为拆箱的时候对象为空,所以拆箱报错,integer对象到int基本类型会自动拆箱。而integer为空,所以报错。

猜你喜欢

转载自blog.csdn.net/pulong0748/article/details/81702381