Multiple choice technology web technology

Objects are passed by value or by reference?

  1. only pass by value

  2. only pass by reference

  3. supports both

  4. none of the above

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Java always passes references by value - the reference itself is copied, but both copies point to the same object. This means modifications to the object are visible to the caller, but reassigning the reference is not. The 'pass by value' terminology refers to the reference copy, not the object.