Just because you cannot make new T[...] does not mean that you cannot have a variable of type T[] , just as you cannot make new T() does not mean that you cannot have a variable of type T
It is perfectly possible to have the correct code that has methods that return T[] :
class Something<T> { T[] foo; Something(T[] in) { foo = in; } T[] splitXXX() { return foo; } }
Produces many cool exercises,
Well, if it throws exceptions, it means that you are doing something wrong. You didnโt show us which code throws exceptions or something else, but you are likely making throws that are not valid in your code.
source share