import java.util.Arrays;
import java.util.List;
public class MainClass {
public static void main(String[] a) {
List list = Arrays.asList(new String[] { "A", "B", "C", "D" });
Object[] objArray = list.toArray();
for (Object obj : objArray) {
System.out.println(obj);
}
String[] strArray = (String[]) list.toArray(new String[list.size()]);
for (String string : strArray) {
System.out.println(string);
}
}
}
|