The statement int list 5 10 15 20 initializes list to have
The 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
Option 3 is correct ( initializes list to have 4 int values)
The syntax here implies direct initialization of integer array named list with 4 initial values.there is no need to mention size for this kind of syntax.
![The 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 The 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](/WebImages/24/the-statement-int-list-5-10-15-20-initializes-list-to-have-1061535-1761554627-0.webp)