-1
package com.mkyong.test;

public class Main {

    public static void main(String[] args) {
        String something = "";
        callSomething(something);

        System.out.println(something);
    }

    private static String callSomething(String something) {
        something = "Hello Wrold !";
        return something;
    }
}
Konstantin Yovkov
  • 60,548
  • 8
  • 97
  • 143
Azhar Mohamed
  • 355
  • 3
  • 10

1 Answers1

0

No, in the method, you are changing the reference of the local variable something.

Change your method call to:

something = callSomething(something);
Stultuske
  • 8,840
  • 1
  • 22
  • 34