package com.swain.cell;
import java.util.ArrayList;
import java.util.List;
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("program.");
Object[]
s1 = list.toArray(new String[0]);
for (int i = 0; i < s1.length; ++i) {
String
contents = (String) s1[i];
System.out.print(contents);
}
}
}
No comments:
Post a Comment