帮我看看对象的引用这两段代码
package string;
public class yinyongto {
public static void main(String[] args) {
String str="hello";
fun(str);
System.out.println(str);
}
public static void fun(String temp)
{
temp="world";
}
}
结果是hello
下一段是
package string;
class demo
{
int x=10;
}
public class index {
public static void main(String[] args) {
demo d= new demo();
d.x=30;
fun(d);
System.out.println(d.x);
}
public static void fun(demo temp)
{
temp.x=100;
}
}结果是30 我想说为什么上一个的结果不是world temp不能修改了内容断开连接么