Advertisements
Advertisements
प्रश्न
State a difference between call by value and call by reference.
अंतर स्पष्ट करें
उत्तर
Call by Value | Call by Reference |
(i) In call by value the method creates its new set of variables (formal parameters) to copy the value of actual parameters and works with them. | (i) In call by reference, reference of the actual parameters is passed on to the method. No new set of variables is created. |
(ii) Any change made in the formal parameter is not reflected in the actual parameter. | (ii) Any change made in the formal parameter is always reflected in the actual parameters. |
(iii) Primitive data types are passed by call by value. | (iii) Reference types like (objects, array etc.) are passed by call by reference. |
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?