8:10 pm - Thursday October 18, 2018

ArrayList Example Program for add(E e)

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
boolean add(E e).It is used to check whether given element append in end of the List or not
*/
import java.io.*;
import java.util.*;
public  class ArrayListAppendsBoolean
{
public static void main(String arg[])throws Exception
{
ArrayList E=new ArrayList();//to create object for ArrayList class
E.add(12);//to add an element in arrayList
E.add(10);//to add an element in arrayList
E.add(6);//to add an element in arrayList
Boolean b=new Boolean (E.add(5));//to check whether given element append in end of the List or not
System.out.println(E);
System.out.println(b);
}
}

Output:
[12,10,6,5]
True

BACK

Filed in: Z-A All Java Codes

Comments are closed.