Inicio
/
Tecnología
/
Which of the Following Are Valid Arrays? I Int[]coolArray= 1,2,3 II . Int[] ThreeThings = (1.8, 2.8,3.8) Int[]threeThings={ 1.0,2.0,3.0

Problemas

Which of the following are valid arrays? I int[]coolArray= 1,2,3 II . int[] threeThings = (1.8, 2.8,3.8) int[]threeThings={ 1.0,2.0,3.0 III int[]= ''1'',''2'',''3'' II only III only I and II I only I and III

Roztwór

Armando veterano · Tutor durante 9 años
Weryfikacja ekspertów
4 (194 Votos)

Respuesta

I onlyExplanation:I. is a valid array declaration and initialization in Java. It declares an integer array named "coolArray" and initializes it with the values 1, 2, and 3.II. The declaration `int[] threeThings = {1.8, 2.8,3.8)` is not valid because the values are not integers. The correct declaration should be `double[] threeThings = {1.8, 2.8, 3.8}`.III. is not valid because the values are strings, not integers. The correct declaration should be `String[] coolArray = {"1", "2", "3"}`.