how to fix java.lang.IndexOutOfBoundsException

后端 未结 7 1320
长发绾君心
长发绾君心 2020-12-10 23:58

Exception in thread \"main\" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:604)

7条回答
  •  时光说笑
    2020-12-11 00:55

    lstpp is empty. You cant access the first element of an empty list.

    In general, you can check if size > index.

    In your case, you need to check if lstpp is empty. (you can use !lstpp.isEmpty())

提交回复
热议问题