Multiple choice technology architecture

Which will legally declare, construct, and initialize an array?

  1. int [] myList = {"1", "2", "3"};

  2. int [] myList = (5, 8, 2);

  3. int myList [] [] = {4,9,7,0};

  4. int myList [] = {4, 3, 7};

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Option D shows correct Java array syntax: int myList[] = {4, 3, 7}; - this declares an int array, initializes with values. Option A is wrong because String array literals cannot be assigned to int array. Option B uses wrong syntax (parentheses instead of braces). Option C declares 2D array but provides 1D initialization.