Multiple choice technology programming languages

Which code in the given options if put in below Main class will not print “Done”?

  1. Function call:- changeName(im); Function implementation :- { im.name = "Done"; return null; }

  2. Function call:- changeName(im); Function implementation :- { im = new Item("Done"); return null; }

  3. Function call :- im = changeName(im); function implementation :- { Item otherObject = new Item("Done"); return otherObject; }

  4. All of the above

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

In option B, the function reassigns the local parameter im to a new Item, but Java passes parameters by value for object references. The reassignment doesn't affect the caller's reference - the original Item object remains unchanged. Options A and C both mutate or return the actual object.