How do you solve this exercise? I am stuck on instruction 1.

remember the get method takes in an `**integer**`

which represents the index of an element in the ArrayList you are calling it on.

indices in an array start from `0 to n-1`

where n is the capacity of the list.

So starting from 0 what position will the element 89 be?

weeklyTemperatures.add(2, 111);

System.out.println( weeklyTemperatures.get(2) );

this is my code but for some reason it doesn’t work. Can someone tell me what is wrong? It’s not working.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.