how to fix java.lang.IndexOutOfBoundsException

后端 未结 7 1342
长发绾君心
长发绾君心 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:54

    You want to get an element from an empty array. That's why the Size: 0 from the exception

    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

    So you cant do lstpp.get(0) until you fill the array.

提交回复
热议问题