Aliasing occurs primarily on assignment issues:
The assignment to the base data type is simple. The base data type stores the actual numeric value, not the reference to an object, so when you assign it, you copy the contents of one place directly to the other. For example, if you use a=b for the base data type, then B copies the contents of a. and b is not affected by this modification at all.
However, when the object is "assigned", the situation changes. When you manipulate an object, we actually manipulate the reference to the object. So if you "assign an object to another object", you actually copy the reference from one place to another. This means that if you use C=d for an object, Then both C and D point to the object that was originally directed to D.
Note the differences between the basic data types and objects in Java.
Such as:
In this, from N1=n2, N1 and N2 point to the same memory address, meaning that the memory address of the N1 is replaced by the N2 memory address, then, when modifying the value of N1, will also modify the value of N2, from. When you remove the ". I", you can see the memory changes
The alias mechanism in Java