Collections
Collections
- 13
未開放
留言 (3)
- 受歡迎
- 新
- 舊
你必須登入才能留言
Jimmy
29 五月, 07:31
8. What method should be used to remove an element from the middle of an ArrayList?
ArrayList<String> list = new ArrayList<>();
list.add("Apple");
list.add("Banana");
list.add("Cherry");
list.add("Date");
// Remove the element at index 2 ("Cherry")
list.remove(2);
// Resulting list: ["Apple", "Banana", "Date"]
System.out.println(list);
0
Harshit GargExpert
3 十一月 2023, 18:24
What method should be used to remove an element from the middle of an ArrayList?
+2
Kingpvz
30 十一月 2024, 08:58
neither of the answers they provided is correct
+1