Generic object of type array? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Generic object of type array?

Can the generic parameter be an array? Like: Sample<String[]> s = new Sample<String[]>();

15th Sep 2019, 2:16 PM
Jamie Charles
1 Resposta
0
Yes. You can test it with an ArrayList: ArrayList<int[]> myArrays = new ArrayList<>(); Now you can add integer arrays in this list. ArrayList<String[]>() for String arrays and so on.
15th Sep 2019, 8:02 PM
Denise RoƟberg
Denise RoƟberg - avatar