1import java.util.ArrayList;
2public class ArrayListClearMethodExample
3{
4 public static void main(String[] args)
5 {
6 ArrayList<Integer> al = new ArrayList<Integer>(4);
7 al.add(9);
8 al.add(3);
9 al.add(5);
10 al.add(1);
11 System.out.println("ArrayList before clear() method: " + al);
12 al.clear();
13 System.out.println("ArrayList after clear() method: " + al);
14 }
15}