/* * Created on Jun 18, 2008 * * To change the template for this generated file go to * Window>Preferences>Java>Code Generation>Code and Comments */ package www.in;
/** * @author mobilejava005 * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ import java.util.*;
public class CollectionToArray{ public static void main(String[] args){ List list = new ArrayList(); list.add("This "); list.add("is "); list.add("a "); list.add("good "); list.add("boy."); // Iterator it=list.iterator(); // while(it.hasNext()) // { // System.out.println(it.next()); // } Object [] s1=list.toArray(); for(int i=0;i<s1.length;i++) { String contents=s1[i].toString(); System.out.println(contents);