• Register
0 votes
430 views

Problem :

I am getting bellow error while compiling Arraylist

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

6 5 3
6,930 points

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

9 7 4
38,600 points

Related questions

0 votes
1 answer 31 views
0 votes
1 answer 35 views
35 views
Problem : Currently I am learning Java. I have written code in Java but it gives me below error &ldquo;Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at Minesweeper.main(Minesweeper.java:5)&rdquo;. I am unable to understand above error. How can I fix above error.
asked Feb 22 mphil 2.3k points
0 votes
1 answer 13 views
13 views
explain with an example?
asked Nov 18 jagruthi 680 points
1 vote
1 answer 52 views
52 views
Problem: I am a begginer in java programming language and I have been coding for just some days. To practice my programming I wrote this code in java: public class Main { public static void main(String[] argv){ int 2count, h-l, a/b, } } But It shows me the error message ... , . expected Syntax error on token ",", ;expected at Main.main(Main.java:3) Whats is wrong in my code can anyone help me out?
asked Apr 6 LizzyM 6.1k points
1 vote
1 answer 20 views
20 views
Problem : I have very recently started to learn programming in Java. I am trying to execute my java code but I am facing the below error. &ldquo;Exception in thread "main" java.lang.arrayindexoutofboundsexception:&rdquo; I am unable to understand above error. Please find below my code: ... according to my debugger*/ myodd[j] = input[i]; j++; } return myodd; } Please help me in fixing above error.
asked Mar 30 morrisBson 3.2k points