1Z0-811 Arrays and Methods Practice Question
Which of the following is not a valid array variable declaration in Java?
⚠ Common exam trap
Oracle often tests the distinction between array declarations and primitive variable declarations, trapping candidates who think `int arr;` is a valid array declaration because they overlook the missing brackets.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
int arr;
`int arr;` declares a simple integer variable, not an array. In Java, an array variable declaration must include square brackets ([]) to indicate the variable is an array type. Without brackets, the variable is a primitive or reference type, not an array.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
int arr;
Why this is correct
`int arr;` declares a primitive integer variable, not an array. For a variable to be declared as an array in Java, the square brackets `[]` must be present, either immediately following the type (e.g., `int[] arr;`) or after the variable name (e.g., `int arr[];`). Without these brackets, the declaration specifies a single `int` value, satisfying the question's requirement for an invalid array variable declaration.
- ✗
int[] arr[];
Why it's wrong here
Valid: declares a 2D array.
- ✗
int[] arr;
Why it's wrong here
Valid: declares an array of ints.
- ✗
int arr[];
Why it's wrong here
Valid: another syntax for array declaration.
Go deeper
Related to this question
About these practice questions
One of 481 original 1Z0-811 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This 1Z0-811 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-811 exam.