Monday, 23 May 2011

array collection in java

import java.util.Arrays;
import java.util.List;
import java.util.Iterator;

public class ArraysToCollection{
    public static void main(String[] args){
    String[] array = {"Java", "Struts", "JSP", "J2EE"};
    List list = Arrays.asList(array);
    Iterator iterator = list.iterator();
    System.out.println("\nThe values into Array");
    while (iterator.hasNext()){
     System.out.println((String) iterator.next());
     }
   }
}

No comments: