import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ListToArray {
public static void main(String[] args) {
List<String> letters = new ArrayList<String>();
//example
letters.add("A");
letters.add("B");
letters.add("C");
//convert list to array
String[] strArray = new String[letters.size()];
strArray = letters.toArray(strArray);
System.out.println(Arrays.toString(strArray)); //打印数组
}
}
输出结果为
[A, B, C]