Introduction / Context:
This question checks the syntax for correct array declarations in Java.
Concept / Approach:
In Java arrays:
- The brackets [] must follow either the type or the variable, but not the access modifier directly.
- Array size cannot be given at declaration (e.g., int a[3] is invalid in Java).
Step-by-Step:
Option A: Valid declaration.Option B: Valid declaration.Option C: Invalid syntax.Option D: Invalid (size not allowed in declaration).Option E: Invalid (size inside brackets not allowed in declaration).
Final Answer:
1, 2, and 6
Discussion & Comments