1Z0-811 Arrays and Methods Practice Question
A method 'public static void modify(int[][] matrix) { matrix[0][0] = 99; }' is called with 'int[][] values = {{1,2},{3,4}}; modify(values);'. What is the value of values[0][0] after the call?
⚠ Common exam trap
Test-takers frequently confuse pass-by-value with pass-by-reference for objects, mistakenly thinking the method cannot modify the original array, or they assume an exception occurs due to incorrect array indexing.
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
✓
99
Java passes object references by value. When 'modify(values)' is called, the reference to the 2D array is copied into the method parameter 'matrix'. Since 'matrix' points to the same array object, modifying 'matrix[0][0]' directly changes the original array's element, so 'values[0][0]' becomes 99.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
99
Why this is correct
The method modifies the original array element.
- ✗
Exception
Why it's wrong here
No exception; the array indices are valid.
- ✗
1
Why it's wrong here
The original value is overwritten.
- ✗
0
Why it's wrong here
No change to 0.
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.