Computer Applications
Answer
Call by value | Call by reference |
---|---|
Actual parameters are copied to formal parameters. Any changes to formal parameters are not reflected onto the actual parameters. | Formal parameters refer to actual parameters. The changes to formal parameters are reflected onto the actual parameters. |
All primitive data types are passed using Call by value. | All reference data types like arrays and objects of classes are passed using Call by reference. |
Related Questions
Write a method which is used to swap the values of two memory locations by using a third variable.
Write a method which is used to swap the values of two memory locations without using a third variable.
What are the advantages of defining a method in a program?
What is meant by method overloading? In what way it is advantageous?