Passing a String parameter to a function and change it
<p>When passing String <strong>a</strong> to <strong>myFunction()</strong> , I pass the reference. Why when it exits, the reference points to the old String ? Doesn't it use the real reference to the string ? </p>

<pre><code>import java.time.*;

public class Main {
    public static void main(String[] args) {
        String a = "aaa";

        myFunction(a);

        System.out.println(a);
    }

    private static void myFunction(String a) {
        a = a + "111";
        System.out.println(a);
    }
}
</code></pre>