Limited access

Upgrade to access all content for this subject

Consider the following code segment.

ArrayList<Integer> list = new ArrayList<Integer>();
list.add(7);
list.add(5);
list.add(1);
list.add(3);
list.add(1);
list.remove(1);
System.out.print(list);

What is printed as a result of executing the code segment?

A

[7, 5, 1, 3, 1]

B

[7, 5, 3]

C

[7, 1, 3, 1]

D

[7, 5, 3, 1]

E

[ ]

Select an assignment template