1Z0-811 Java Basics and Syntax Practice Question
A method receives an int parameter and modifies its value inside the method. Does this change affect the caller's argument?
⚠ Common exam trap
Oracle often tests the misconception that Java passes objects by reference, leading candidates to incorrectly assume primitives also allow modification of the caller's variable, but the trap here is that all Java parameters are passed by value, including primitives.
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
✓
No, because Java passes a copy of the value
Java uses pass-by-value for all parameters. When an int is passed to a method, a copy of the value is made, so modifications inside the method affect only the copy, not the original variable in the caller's scope.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
No, unless the parameter is marked as volatile
Why it's wrong here
volatile does not change pass-by-value semantics.
- ✗
Yes, because the parameter is an int
Why it's wrong here
The parameter is a copy, so changes are local.
- ✓
No, because Java passes a copy of the value
Why this is correct
Primitives are copied; the original is unaffected.
- ✗
Yes, because Java passes a reference
Why it's wrong here
Primitives are passed by value, not reference.
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.