3:13 pm - Friday December 16, 8698

Collections example program for checkedCollection(Collection c, Class type)

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

/*program :Collections Example program for enumeration(Collection c)
author  :"candid"
date    :29.10.12*/
import java.awt.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
public class CollectionsDemo {
public static void main(String args[]) {
ArrayList arrlist = new ArrayList();
arrlist.add("A");
arrlist.add("B");
arrlist.add("C");
Enumeration e = Collections.enumeration(arrlist);
System.out.println("Print the enumeration");
while (e.hasMoreElements()) {
System.out.println("Value is: " + e.nextElement());
}
}
}

//Output

Print the enumeration
Value is: A
Value is: B
Value is: C

BACK

Filed in: Z-A All Java Codes

Comments are closed.