Java tutorial
import java.util.ArrayList; public class Main { public static void main(String[] args) { ArrayList<Integer> arrlist = new ArrayList<Integer>(5); // use add() method to add elements in the list arrlist.add(20); arrlist.add(30); arrlist.add(10); arrlist.add(50); System.out.println(arrlist); // finding size of this list int retval = arrlist.size(); System.out.println("List consists of " + retval + " elements"); arrlist.clear(); retval = arrlist.size(); System.out.println("list consists of " + retval + " elements"); } }