String astr = "hello"
change(astr);
System.out.println(astr);
private void change(Sting str){
str ="world";
}
hello!!!!!!
其实String赋值会重新分配内存
String astr = "hello"
change(astr);
System.out.println(astr);
private void change(Sting str){
str ="world";
}
hello!!!!!!
其实String赋值会重新分配内存