This example shows you how to Convert string array to an Collection.
Here is the code
/**Output
* @ # StringArray3.java
* A class repersenting how Convert
* string array to a collection
* version 04 June 2008
* author Rose India
*/
import java.util.*;
public class StringArray3 {
public static void main(String args[]){
String arr[] = {"Zero", "One", "Two"};
//Convert string array to a collection
Collection l = Arrays.asList(arr);
ArrayList list = new ArrayList(l);
System.out.println("list = " + list);
}
}
list = [Zero, One, Two] |
No comments:
Post a Comment