Use Java to pass values and references, and use java to pass references
In Java, variables are divided into the following two types,
1. for basic type variables, Java is a copy of the value, and its own copy changes instantly, and it will not change.
2. For all object-type variables, Java transmits a reference copy, that is, the copy pointer to the address, and the reference copy passed by it points to its own address.
Eg: Do you want Michael to open the warehouse and check the goods in the warehouse (the Warehouse is equivalent to the address)? Is it necessary to create a warehouse (and place the same goods) for Michael?
No. You just need to copy the key (reference) to Michael Jacob. Michael Jacob will open the warehouse with the copied key (reference the copy, but it is time-effective, the function ends, and the key is destroyed.
Note: The String type is also an object-type variable, so it must be a reference copy, but the String is an immutable class, which makes it no different to pass the value or reference.