日期:2014-05-20 浏览次数:20635 次
(Integer[])array;
Object[] os = new Object[] { 1, 2, 3 }; Integer[] is = Arrays.asList(os).toArray(new Integer[0]);
------解决方案--------------------
当然不行,程序会抛出can't cast的错误!
------解决方案--------------------
这样可以
public static void main(String[] args) {
Integer[] a = {1,2,3,4,5,6};
Object[] o = a;
Integer[] b= (Integer[])o;
System.out.println(Arrays.toString(b));
}
------解决方案--------------------