in other word: If I pass an ArrayList (java.util.ArrayList) object to a class, will it be automatically updated when I change it?
Yes
Does the List object passed by reference?
Value of reference would get passed
public updateList(List<String> names){
//..
}
Explanation
When you call updateList(someOtherList);
the value of someOtherList
which is a reference will copied to names
(another reference in method, bit by bit) so now both of them are referring to same instance in memory and thus it will change
See
- Is Java “pass-by-reference” or “pass-by-value”?