Value is passed on and passed by reference

 

Reference data type is passed by reference (call by reference), the value passed is the basic data type (call by value)
Value transfer can not change the content and address of the original variable --- "shape because of the java method of transmission parameters are transmitted a copy of the original variables, it is changed in the copy of the value of the process, not suitable for the raw variables
Passed by reference address can not change the original variables, but you can change the contents of the original variables --- "The reason is to change the reference when a copy of the original variable references has not changed, when a copy of the changed content, due to the copy of the reference points it is the address space of the original variable, so the contents of the original variable changes.

Conclusion: 1. The value is passed and can not change the contents of the address of the original variables;
           2. The reference delivery address can not change the original variables, but you can change the contents of the original variables;

Guess you like

Origin www.cnblogs.com/yz123/p/11916839.html