ArraySizeDemo = > ArraySizeDemo ar = new ArraySizeDemo();, , -
Memory :
...
anArray point to 0x100
...
int arr[] = {0,1,2,3,4,5,6,7,8,9};
Memory :
-------------------------
...
anArray point to 0x111
arr point to 0x222
...
-------------------------
and when ar.setAnArray(arr)you call, you transfer the link arr, which is in the demo version0x222
and in the body setAnArray()you change the link anArrayto the transmitted linkthis.anArray = anArray;
so after calling ar.setAnArray(arr)
Memory :
-------------------------
...
anArray point to 0x222
arr point to 0x222
...
-------------------------
source
share