When I compile this code:
public class OuterClass<T>
{
    class InnerClass
    {
       T temp;
    }
    
    private InnerClass[] theArray;
    
    public OuterClass(int size){
       this.theArray = new InnerClass[size];
  }
}
I get this error:
OuterClass.java:10: error: generic array creation
      this.theArray = new InnerClass[size];
So my question #1 is: why is creating an array of InnerClass a problem? After all, it's an array of objects, not of a generic type.
My question #2 is: why does modifying the code (see below) resolve the problem?
public class OuterClass<T>
{
    class InnerClass<U>  //changed this line
    {
       T temp;
    }
    
    private InnerClass<T>[] theArray;  //changed this line
    
    public OuterClass(int size){
       this.theArray = new InnerClass[size];
  }
}
 
     
    