In a java program, I want 3 arraylist variables to be modified by a call to a single function.
Am I correct in thinking that if I pass these 3 arraylists as parameters to that function, then all 3 can be modified within the function? Or will I have to modify each arraylist in a separate function, and specify that array list as the return value, to ensure that it is modified.
In a word, yes.
It is worth noting that the “by reference” terminology in the title of your question is not exactly right. In Java, everything is passed by value, including object references. It is the fact that the three
ArrayListparameters are references themselves that makes any changes made to the lists propagate back to the caller.