The value is passed on java and passed by reference (that is, address transfer)

Explain the concept:

  1. Value is passed, pass a value change occurs in the function parameter does not affect the argument.
  2. Passed by reference, pass object references, changes in the function parameter arguments occurring impact.

=============================================================================================================

1. For the basic data types, variable is worth referring to the copy;

2. For objects (or package basic types String, Integer, etc.), refers to a copy target address, that is the value passed is the address of the object;

 

Guess you like

Origin www.cnblogs.com/curedfisher/p/11730279.html