What is list after the following code is executed?

```
ArrayList list = new 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.

Computer Science & Information Technology

You might also like to view...

If you need to develop tables, both word processing and spreadsheet software may be options

Indicate whether the statement is true or false

Computer Science & Information Technology

By embedding the macro it becomes ________, and if you export the form into another database, any macros embedded will remain with the object

A) portable B) manageable C) functional D) efficient

Computer Science & Information Technology