Hello,
Can somebody help me with the problem I have? Anyways, I have a ArrayList that consists of Arraylist that consists of 3 elements. [[a1, 11, x], [a2, 12, ], [a3, 13, ], [a4, 14, o]]. The 0th and second element are both strings, the first one an integrer.
At the moment I need to tage the first element and save it to a variable.
int a = (int)(((ArrayList) array.get(randomLocation)).get(1));
It sends an error message
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Type mismatch: cannot convert from Object to int.
But when I try to print it out, everything works perfectly
System.out.println(((ArrayList) array.get(randomLocation)).get(1));
Thanks in advance!