本帖最后由 Marx_D 于 2015-8-27 22:20 编辑
- <div class="blockcode"><blockquote>import java.util.ArrayList;
- public class Demo2 {
- public static void main(String[] args) {
- ArrayList<Integer> al = new ArrayList<Integer>();
- al.add(1);
- al.add(2);
- al.add(3);
- al.add(4);
- int[] arr1 = new int[al.size()];
- for (int x = 0; x < al.size(); x++) {
- arr1[x] = al.get(x); //注意看这里,括号
- System.out.println(arr1[x]);
- }
- }
- }
复制代码
|