10:23 pm - Monday May 21, 2018

ArrayList Example Program for get(int index)

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
E get(int index).It is used get an element in specified index of arrayList
*/
import java.io.*;
import java.util.*;
public class ArrayListGet
{
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
System.out.println(al.get(1));//to get an element in specified index of arrayList
}
}

Output:
60

BACK

Filed in: Z-A All Java Codes

Comments are closed.