不允许使用参数化类型的数组.
//Cannot create a generic array of BoxBox [] arrayOfLists = new Box [2];
因为编译器使用类型擦除,所以type参数替换为Object,用户可以向数组添加任何类型的对象.并且在运行时,代码将无法抛出ArrayStoreException.
// compiler error, but if it is allowedObject[] stringBoxes = new Box[]; // OKstringBoxes[0] = new Box (); // An ArrayStoreException should be thrown,//but the runtime can't detect it.stringBoxes[1] = new Box ();