Slalom Interview Question

What is the difference between passing by value and passing by reference? (Java)

Interview Answer

Anonymous

Aug 9, 2017

Pass by value means that the both the caller method and the callee have parameters that are two different variables with the same initial value. The callee may change the value of this variable, but that change will not be reflected at the caller level or anywhere else besides the callee's scope. Pass by reference means that both the caller method and the callee have the exact same variable as their parameter. If this variable's value is changed by the callee, it will reflect at the caller level.