Program
import java.util.ArrayList; public class ArralistIntSize { public static void main(String[] args) { ArrayList<Integer> list = new ArrayList<Integer>(); list.add(10); list.add(100); list.add(15); list.add(30); list.add(80); list.add(60); for(Integer num : list) { System.out.println(num); } int count = list.size(); System.out.println("Int Size():"+count); } }
Output
10 100 15 30 80 60 Int Size():6
Description
public int size()
Returns the number of elements in this list.
Specified by:
size in interface Collection<E>
size in interface List<E>
Returns:
the number of elements in this list