What is list after the following code is executed?
```
ArrayList
list.add(1);
list.add(2);
list.add(3);
list.add(4);
list.add(5);
list.remove(2);
System.out.println(list);```
a. [1, 2, 3, 4, 5]
b. [2, 3, 4, 5]
c. [1, 3, 4, 5]
d. [1, 2, 4, 5]
e. [1, 2, 3, 4]
d The ArrayList class has two overloaded remove method remove(Object) and remove(int index). The latter is invoked for list.remove(2) to remove the element in the list at index 2.
You might also like to view...
An ARM device uses the same traditional CPU as most personal computers
Indicate whether the statement is true or false
When a(n) ____ occurs, the interpreter default behavior is to display an error message and force the immediate termination of the program.
A. syntax B. error C. exception D. runtime
The Folder class gives you access to various folder administration methods.
Answer the following statement true (T) or false (F)
Which of the following devices is useful where there are multiple computers but no need for a dedicated keyboard, monitor, and mouse for each one?
A) KVM switch B) Inverter C) Switch D) USB hub