• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes
39 views

Problem :

I am getting bellow error while compiling Arraylist

exception in thread "main" java.lang.indexoutofboundsexception: index: 0, size: 0

by (6.9k points)  
edited by

1 Answer

0 votes

Solution:

It seems "ArrayList<ArrayList<Integer>> " this list doesnt have any element at the (0)th postion and now the compiler throws "out of bounds exception" as it doesn't find any element in that postion.

when you try executing bellow code

list.get(0).set(placeHolder.get(k), (int) (Math.random() * (99999) + 1)); 

 your list is empty so you need to iterate through the inner list to set the values for the list.

Further Readings:

https://github.com/owlcs/owlapi/issues/724

by (22.5k points)  
edited by
...