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

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site