Answers for "java.lang.IndexOutOfBoundsException: Index: 1, Size: 0 at java.util.ArrayList.add(ArrayLis"

7

java.lang.IndexOutOfBoundsException: Index: 1, Size: 0 at java.util.ArrayList.add(ArrayList.java:483)

//if Your arrayList is empty. its crashing
yourlist.add(1,"data");

//you can use this code
yourlist.add("data");
Posted by: Guest on March-10-2021

Code answers related to "java.lang.IndexOutOfBoundsException: Index: 1, Size: 0 at java.util.ArrayList.add(ArrayLis"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language