Home / Questions / Differentiate between call by value or pass by value and call by reference or pass by reference. Java Language
Explanatory Question

Differentiate between call by value or pass by value and call by reference or pass by reference. Java Language

👁 153 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

Call by value Call by reference
Values of actual parameters are copied to formal parameters. Reference of actual parameters is passed to formal parameters.
Changes made to formal parameters are not reflected back to actual parameters. Changes made to formal parameters are reflected back to actual parameters.

Difference between call by value and call by reference:

  • Call by value: A copy of the actual parameter is passed to the function. Changes made to the parameter inside the function do not affect the original argument.
  • Call by reference: A reference to the actual parameter is passed to the function. Changes made to the parameter inside the function affect the original argument.