Multiple choice technology programming languages

Which three form part of correct array declarations?

  1. public int a []

  2. static int [] a

  3. private int a [3]

  4. public final int [] a

  5. public [] int a

  6. private int [3] a []

Reveal answer Fill a bubble to check yourself
A,B,D Correct answer
Explanation

Valid Java array declarations can place brackets before or after the variable name, but cannot specify array size in the declaration. Option A (public int a []) is valid. Option B (static int [] a) is valid. Option C is invalid - cannot specify [3] in declaration. Option D (public final int [] a) is valid. Option E is wrong syntax ([] must follow type). Option F is invalid - cannot specify [3] in declaration.