he statement int list 5 10 15 20 initializes list to have
he statement int[ ] list = {5, 10, 15, 20};
initializes list to have 5 int values
initializes list to have 20 int values
initializes list to have 4 int values
declares list but does not initialize it
causes a syntax error because it does not include \"new int[4]\" prior to the list of values
| initializes list to have 5 int values | ||
| initializes list to have 20 int values | ||
| initializes list to have 4 int values | ||
| declares list but does not initialize it | ||
| causes a syntax error because it does not include \"new int[4]\" prior to the list of values |
Solution
int[ ] list = {5, 10, 15, 20};
Answer:
initializes list to have 4 int values
The above statement is an example of array declaration and initialization, both combined as a single statement. The array initialization usually do with the help of curly braces. Here the elements will store at indexes 0,1,2,and 3.
| initializes list to have 4 int values |
![he statement int[ ] list = {5, 10, 15, 20}; initializes list to have 5 int values initializes list to have 20 int values initializes list to have 4 int values d he statement int[ ] list = {5, 10, 15, 20}; initializes list to have 5 int values initializes list to have 20 int values initializes list to have 4 int values d](/WebImages/1/he-statement-int-list-5-10-15-20-initializes-list-to-have-968095-1761495416-0.webp)