problem with the listof in java


I have a problem that I can not solve and it is because I mark the word of error when I'm creating a list. I have the class imported

List<Integer> numeros = List.of(1,2,3,4);
asked by Tiago Viezzoli 27.11.2018 в 04:19

1 answer


You can use this code that allows you to do what you need.

 List<Integer> numeros = Arrays.asList(1,2,3,4,5);
answered by 27.11.2018 в 15:27