Your code has multiple errors.
- First of all, that line is not declaring a variable, and therefore you don't specify the type (
ArrayList).
- Assuming your variable is called
Obj, I would recommend you to call it something meaningful and name variables starting with lower-case letters (same deal with Str).
- Do not add a dot (
.) after the method name (get(index)).
After that, your line should look like this:
list.get(index).add(str);
To give you a better understanding, you can split that line of code in multiple lines:
List<String> subList = mainList.get(index);
subList.add(str);