Multiple choice general knowledge

identify the correct syntax to declare an array

  1. int[ ] anArray

  2. int anarray[ ]

  3. int [ ]anarray[ ]

  4. all the above

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

In Java, array declarations can use the bracket notation before the variable name, after it, or both - all three syntaxes (int[] arr, int arr[], int []arr[]) are valid.