In Java, variables are divided into the following two classes,
1, for the basic type of variable, Java is a copy of the value, the instant its own copy has changed, and will not change itself.
2, for all object-type variables, Java is a copy of the reference, that is, copy the pointer to the address, it passes the reference copy to its own address.
Eg: you want to Zhang San (Zhang San equivalent function) to open the warehouse, and check the Library of goods (warehouse equivalent address), it is necessary to create a new warehouse (and put the same goods) to Zhang San?
No need, you just have to copy the key (reference) to Zhang San, Zhang San will copy the key (reference copy, but the timeliness, function end, key destruction) Open the warehouse.
Note: The string type is also an object-type variable, so he must be a copy of the reference, except that string is an immutable class, making it no different to pass or pass a reference.
Java pass-through value and pass-through reference