实现代码:
1
2
3
4
5
6
7
|
List<String> list = new ArrayList<String>();
list.add( "a1" );
list.add( "a2" );
String[] toBeStored = list.toArray( new String[list.size()]);
for (String s : toBeStored) {
System.out.println(s);
}
|
或
1
2
3
4
5
6
7
8
9
|
List<String> list = new ArrayList<String>();
list.add( "a1" );
list.add( "a2" );
String[] toBeStored = new String[al.size()];
list.toArray(toBeStored);
for (String s : toBeStored) {
System.out.println(s);
}
|
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!