in "Oracle Certifi ed Associate Java SE 8 Programmer I Study Guide" speaking about passsing by value , saying : Calling methods on a reference to an object does affect the caller
public static void main(String[] args) {
StringBuilder name = new StringBuilder();
speak(name);
System.out.println(name); // Webby
}
public static void speak(StringBuilder s) {
s.append("Webby");
}
In this case, the output is Webby because the method merely calls a method on the parameter. It doesn’t reassign name to a different object.
So what does this mean? I didn't get it. Shouldn't there be 2 different objects?