-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;
}
}
变化callSomething(东西); to something = callSomething(something); – pwwpche 2015-01-21 07:44:06
另一个相关的问题:http://stackoverflow.com/questions/1270760/passing-a-string-by-reference-in-java – 2015-01-21 07:45:10
字符串对象是不可变的 – JClassic 2015-01-21 07:49:06