1import java.util.ArrayList;
2public class ArrayListRemoveIndexMethodExample
3{
4 public static void main(String[] args)
5 {
6 ArrayList<Integer> al = new ArrayList<Integer>(5);
7 al.add(56);
8 al.add(29);
9 al.add(76);
10 al.add(94);
11 System.out.println("ArrayList size: " + al.size());
12 for(Integer number : al)
13 {
14 System.out.println("Number: " + number);
15 }
16 // removing element at third position
17 al.remove(2);
18 System.out.println("ArrayList size after using remove(int index) method: " + al.size());
19 // printing all elements in list
20 for(Integer number : al)
21 {
22 System.out.println("Number: " + number);
23 }
24 }
25}