According to this answer https://stackoverflow.com/a/12020435/562222 , assigning an object to another is just copying references, but let's see this code snippet:
public class TestJava {
public static void main(String[] args) throws IOException {
{
Integer x;
Integer y = 223432;
x = y;
x += 23;
System.out.println(x);
System.out.println(y);
}
{
Integer[] x;
Integer[] y = {1,2, 3, 4, 5};
x = y;
x[0] += 10;
printArray(x);
printArray(y);
}
}
public static <T> void printArray(T[] inputArray) {
for(T element : inputArray) {
System.out.printf("%s ", element);
}
System.out.println();
}
}
Running it gives:
223455
223432
11 2 3 4 5
11 2 3 4 5