Differentiate between call by value or pass by value and call by reference or pass by reference.
Views 25
Answer:
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.
Related Articles:
This section is dedicated exclusively to Questions & Answers. For an in-depth exploration of Java Programming Language, click the links and dive deeper into this subject.
Join Our telegram group to ask Questions
Click below button to join our groups.