When passing String a to myFunction() , 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 ?
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);
}
}