public class oopDemo4 {
public static void main(String[] args) {
//java属于值传递
int a =1;
System.out.println(a);
change(a);
System.out.println(a);//这里输出a还是等于1
}
public static void change(int a){//(int a)是一个形参,java属于值传递
a = 10;
return;
}
}
public class oopDemo5 {
public static void main(String[] args) {
Perosn perosn = new Perosn();
System.out.println(perosn.name);
change(perosn);
System.out.println(perosn.name);
}
public static void change(Perosn perosn){
perosn.name = "luo";
}
}
class Perosn{
String name;
}