What happens when I do this:
List<Integer> listA = new ArrayList<Integer>();
List<Integer> ListB = new ArrayList<Integer>();
listA = ...filled with some data...
listB = ...filled with some other data...
listA.clear();
listA = listB;
Does values copies or just re-reference? If I now (after this code) call listA.clear() again, will listB clear as well?
Well, after
listA = listBthe variablelistAreferences the same list aslistB. There is no copy-constructor in Java like you have it in C++ etc.