Confused About Object References
The way I understand it is that, if you assign one object reference to another reference variable, they both refer to one object. So if you change one object, it will be reflected across the board. For example, if you have:
Won't this print "Hello World" ?
String str1 = "Hello";
String str2 = str1;
str1 += " World";
If so, then can someone explain to me something? I have a group of arrays of objects, and I'm iterating through and copying their elements like so:
After I finish this, I sort one array. Shouldn't that mean all the other arrays will all be sorted as well, since I'm copying object references?
for (int i = 0; i < lines; i++)
records_ssort[i] = records_bsort[i] = records_isort[i] = records_qsort[i] = records_one[i];