I am unable to determine why the sb object reference value that gets mirrored back to the calling method does not mirror the last value (i.e. null) that it was assigned?
public class Test{
void testRefs(String str, StringBuilder sb){
str = str + sb.toString();
sb.append(str);
System.out.println(sb);
str = null;
sb = null;
System.out.println(sb);
}
public static void main(String[] args){
String s = "aaa";
StringBuilder sb = new StringBuilder("bbb");
new Test().testRefs(s, sb);
System.out.println("s="+s+" sb="+sb);
}
}