In java if Objects are pass by reference than in following code,
String str1 = new String("abc");
String str2 = str1;
str1 = str1+"def";
System.out.println("str2 : "+str2);
Even after modifying string str1
after assigning it to string str2
I get output as str2 : "abc"
instead of "abcdef"
so pass by reference does not work in case of string??