Java passes only a reference, be sure to be aware of exactly what happens when objects are passed and assigned.
In fact, each object in Java (except for the base data type) is one of the pointers, but its use is strictly limited and protected, not only in the compiler, but also at run time.
Java has pointers, but without the hassle of traditional pointers.
When you pass a reference into a method, the same object is still pointed to.
Alias issues
aliases, which are multiple references, point to the same object, and sometimes prevent writing to objects.
Cloning objects
If you need to modify an object and do not want to change the caller's object, you should make a local copy.
Simply use the Clone () method to make an identical copy. This method is protected in object, but it is expected to be available in all subclasses, so overwrite it with the public type.
Java passing and returning objects