package siKao;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class 整体转换 {
/**
* @param args
*/
public static void main(String[] args) {
Integer[] arr={1,2,3,4,5,6};
List<Integer>asList=Arrays.asList(arr);
ArrayList<Integer> list = new ArrayList<Integer>();
list.addAll(asList);
list.add(12);
System.out.println(list.size());
Object[]array = list.toArray();
for (int i = 0; i < array.length; i++) {
System.out.println((Integer)array[i]);
}
System.out.println(array);
Integer[]arr1=(Integer[])array;
Integer[]arr4={1,2,3,4};
Object[]arr3=arr;
System.out.println(arr3);
Integer[]arr2 = (Integer[])arr3;
System.out.println(arr2[2]);
}
}
|
|