Which Three Are Legal Array Declarations?

Which Three Are Legal Array Declarations?

Explanation: (1), (2), and (4) are legal array declarations. With an array declaration, you can place the brackets to the right or left of the identifier.

Which of these are legal array declaration or definition?

Explanation: (1), (2), and (4) are legal array declarations. ... Option A looks strange, but it's perfectly legal to split the brackets in a multidimensional array, and place them on both sides of the identifier.

What are valid array declarations?

The following Java array declarations are actually all valid: int[] intArray; int intArray[]; String[] stringArray; String stringArray[]; MyClass[] myClassArray; MyClass myClassArray[];

Alexander Ross
Author

Alexander Ross

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.