Difficulty: Easy
Correct Answer: false true
Explanation:
Introduction / Context:
This question confirms that Java passes primitives by value, so reassigning a parameter inside a method does not change the caller's variable.
Given Data / Assumptions:
Concept / Approach:
Primitives are copied when passed to methods. Changing the local copy does not affect the original variable. The return value may differ from the original.
Step-by-Step Solution:
Verification / Alternative check:
Print identity or use different names to emphasize the copy behavior.
Why Other Options Are Wrong:
They imply call-by-reference semantics, which Java does not use for primitives.
Common Pitfalls:
Assuming Java can pass primitives by reference; only object references are passed by value (and still by value).
Final Answer:
false true
Discussion & Comments