public class Test {
public static void main(String[] args) {
System.out.println(new CountingGenerator.String(12).next());
List<Integer> list=new ArrayList<Integer>();
list.add(new Integer(1));
list.add(new Integer(2));
Integer[] c = {1,3,3};
//throw an exception:
c = (Integer[]) list.toArray();
}
}
I wonder why this happened ? Integer is a subclass of Object,so it should be Ok instead! please answer me deeply! I want know why? what's the principle ?