I'm new to Java and I'm trying to learn how to parse through an ArrayList within an ArrayList and I can't quite figure it out. I'm used to Python where all you had to do was list[index][index]
. Why am I getting an error reading Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous tree type: <any>
when trying to use list.get(index).get(index)
? Is this not the proper syntax?
import java.io.*;
import java.util.*;
public class Practice {
public static void main(String[] args){
ArrayList list = new ArrayList(Arrays.asList(new Integer[]{1,2,3,4,5,6,7,8,9,10}));
ArrayList list1 = new ArrayList(Arrays.asList(new Integer[]{1,2,3,4,5,6,7,8,9,10}));
list.add(list1);
System.out.println(list.get(10).get(0));
}
}