What is the result of the following statements?
3: ArrayList<Integer> values = new ArrayList<>(); 4: values.add(4); 5: values.add(5); 6: values.set(1, 6); 7: values.remove(0); 8: for (Integer v : values) System.out.print(v);
C.
After line 4, values has one element (4).
After line 5, values has two elements (4, 5).
After line 6, values has two elements (4, 6) because set()
does a replace.
After line 7, values has only one element (6).