Consider the following program:
import java.util.ArrayList; public class Main { public static void main(String []args) { ArrayList<Integer> list = new ArrayList<Integer>(); list.add(new Integer(2)); list.add(1);/*from w w w.j a va 2 s . co m*/ list.add(5); list.remove(2); // REMOVE System.out.println(list); } }
Which one of the following options correctly describes the behavior of this program?
b)
The remove method in ArrayList removes the element at the specified position in the list, and shifts any subsequent elements in the list to the left.