I did two tests, the first starting with Strings
String str1 = \"old\";
String str2 = str1;
str1 = \"new\";
System.out.println(
Everything in java is passed by Value.There nothing like pass by refrence in java.Objects reference is passed by value. in ist case ie
String str1="old"
String str2=str1; //here str2 is pointed to str1
str1="new"; // here link of str1 is broken with old and pinted to new location where as str2 is pointing to same location as earlier.
While in case of list both list are pointing to same memory location so changes are reflected.