2:30 am - Saturday December 15, 2018

ArrayList Example Program for size()

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
/**
*@author :CandidJava.com
*@descriptions : This program explain the function and use of
int  size(). This function used to to return number of element in the list
*/
import java.io.*;
import java.util.*;
public class ArrayListSize
{
public static void main(String arg[])throws Exception
{
ArrayList al=new ArrayList();//to create object for ArrayList class
al.add(50);//to add an element in arrayList
al.add(60);//to add an element in arrayList
al.add(70);//to add an element in arrayList
al.add(45);//to add an element in arrayList
System.out.println(al.size());//to return number of element in the list
}
}

Output:
4

BACK

Filed in: Z-A All Java Codes

Comments are closed.