Home » Java Programming » Language Fundamentals

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

Correct Answer: int myList [] = {4, 3, 7};

Explanation:

The only legal array declaration and assignment statement is Option D


Option A is wrong because it initializes an int array with String literals.


Option B is wrong because it use something other than curly braces for the initialization.


Option C is wrong because it provides initial values for only one dimension, although the declared array is a two-dimensional array.


← Previous Question Next Question→

More Questions from Language Fundamentals

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion