the code is below:
package linear_list; public class SeqList<T> { protected int n; protected T[] element; private static final int MIN_CAPACITY=16; public SeqList(int length){ if (length<MIN_CAPACITY) length=MIN_CAPACITY; this.element=new T[length]; //this row is reported an error this.n=0; } } Why IDEA shows that “Type parameter 'T' cannot be instantiated directly”. What I want to do is declare a generic array.
T newT = (T[]) element.getClass().newInstance()elementis initialized.