Constructing an array with generics is a little trickly.
Let's say you are using "E" for your generic type parameter.
This is then how you would declare and construct an array of generic type "E" (of size 10):
E[] array; array = (E[])new Object[10];
📋
OO With Java
Chapter Generics
Constructing Arrays of Generic Type
Search Site
Home
Back To Top