本帖最后由 黑马李杰 于 2013-4-15 20:41 编辑
package com.j2se.text;
import java.util.Arrays;
public class Test {
public static void main(String[] args) {
int[] arr1 = new int[]{1,2,3};
String[] arr2 = new String[]{"a","b","c"};
System.out.println(arr1);
System.out.println(arr2);
/*
* jdk1.4:public static List asList(Object[] obj)
* jdk1.5:public static <T> List<T> asList(T... a)
*/
System.out.println("arr1:" + Arrays.asList(arr1));
System.out.println("arr2:" + Arrays.asList(arr2));
}
}
这程序不是应该报错么?int[]不能传递给Object[],学的有点混乱了 |