Multiple choice technology programming languages

Which code from the given options if put in 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 Java, arguments are passed by value. Reassigning the reference variable im = new Item("Done") inside the method only changes the local parameter copy, leaving the original object in the calling method unchanged.