Thursday 16 February 2012

converting array to list

package com.usr.collections;

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

public class ArrayToList {
public static void main(String[] args) {
String[] strArr={"one","two","three","four","five","six","seven"};
   
    List<String> strList=Arrays.asList(strArr);
    for(String str:strList){
        System.out.println(str);
    }
}
}


OUTPUT
one
two
three
four
five
six
seven

No comments:

Post a Comment

Note: only a member of this blog may post a comment.