public class Main {
    public static void main(String[] args) {
        int x = 0;
        int[] arr = {20};
        String name = "Vitalii";
        f(x, arr, Name);
        System.out.println(x + " " + arr[0] + " " + Name);
    }
    private static void f(int x, int[] arr, String Name){
        x = 20;
        arr[0] =40;
        name = "Max";
    }
}
The output I have is "0 40 Vitalii". I don't understand why in method f, jvm insert 40 at first position in array, but do nothing to string. Why it doesn't change it's value to "Max"? I'm sure I miss some important concept about “pass-by-reference” or “pass-by-value” or something like this. Thanks for helping.
 
     
     
     
     
    