public class StringT {
public static void main(String[] args) {
String str = "123";
change(str);
System.out.println(str);
}
public static void change(String str) {
str = "456";
}
}
3 回答

澹泊_
TA贡献1条经验 获得超1个赞
public class StringT { public static void main(String[] args) { // TODO Auto-generated method stub String str = "123"; str = change(str); System.out.println(str); } public static String change(String str){ return "456"; } }
下面的函数你没有返回,把456 设为返回值就可以,然后让 Str 接受返回值。
添加回答
举报
0/150
提交
取消