I am trying to understand how the following code works:
ArrayList<String> aInt = new ArrayList<String>();
Object[] bInt = null;
aInt.add("1a");
aInt.add("2b");
aInt.add("3c");
aInt.add("4d");
bInt = new String[aInt.size()];
aInt.toArray(bInt);
for(int i=0; i < bInt.length; i++){
System.out.println(bInt[i]);
}
I understand everything except for the line aInt.toArray(bInt); My question is how is bInt actually being updated using this if you never do bInt = aInt.toString()? I thought java only passes items by value and not reference so I this has me stumped.
I did confirm that the System.out.println statement does print out 1a, 2b, 3c, and 4d.
Thank you for your help