How is the statement in the GenericArrayCreationIsDisallowedInJava constructor working? Could some1 please explain ?
public class GenericArrayCreationIsDisallowedInJava<I> {
    private I[] i;
    public GenericArrayCreationIsDisallowedInJava(int n)
    {
        i = (I[]) new Object[n];//works and prints out "Created". How?
        System.out.println("Created");
    }
    public static void main(String[] args) {
        new GenericArrayCreationIsDisallowedInJava<String>(2);
        String[] strs = (String[])  new Object[2]; // throws ClassCastException. When this statement doesn't work, how is the "(I[]) new Object[n]" statement working? 
    }
}
 
     
     
    