The statement int[ ] list = {5, 10, 15, 20}; initializes list to have 5 int valu
ID: 3920993 • Letter: T
Question
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
Explanation / Answer
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.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.