7:26 am - Monday September 24, 2018

ArrayList Example Program for remove(Object o)

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
remove(Object o).It is used to  check whether first occurence of given element is removed from list or not
*/
import java.io.*;
import java.util.*;
public class ArrayListRemove
{
public static void main(String arg[])throws Exception
{
ArrayList al=new ArrayList();//to create object for ArrayList class
al.add("a");//to add an element in arrayList
al.add("b");//to add an element in arrayList
al.add("c");//to add an element in arrayList
al.add("a");//to add an element in arrayList
System.out.println(al.remove("a"));//to check whether first occurence of given element is removed from list or not
}
}

Output:
true

BACK

Filed in: Z-A All Java Codes

Comments are closed.