比较一
class Getf
{
int x;
public static void main(String[] args)
{
Getf obj = new Getf();
obj.x =5;
change(obj);
System.out.println(obj.x);
}
public static void change(Getf obj)
{
obj.x=3;
}
}
结果:3
比较二
class Getf
{
public static void main(String[] args)
{
int x = 5;
change(x);
System.out.println(x);
}
public static void change(int x)
{
x=3;
}
}
结果:5