226k views
3 votes
Suppose ArrayList x contains two strings [Beijing, Singapore]. Which of the following method will cause the list to become [Beijing]?

1) x.remove(1)
2) x.remove(0)
3) x.add("Tokyo")
4) x.add("London")

1 Answer

1 vote

Final answer:

The correct method to remove the second element from an ArrayList is x.remove(1).

Step-by-step explanation:

The correct method to remove the second element from an ArrayList is x.remove(1). This will cause the list to become [Beijing].

User Dmitry Osinovskiy
by
8.3k points