126k views
5 votes
suppose arraylist x contains two strings [beijing, singapore]. which of the following methods will cause the list to become [beijing, chicago, singapore]?\

User Tumdum
by
8.5k points

1 Answer

4 votes

Answer:

The add method can be used to add "chicago" to the list at index 1. The code would look like:

x.add(1, "chicago");

After this is executed, the list x will contain [beijing, chicago, singapore].

User Iisystems
by
8.7k points