对象的引用

来源:互联网 发布:淘宝网卖家中心 - 首页 编辑:程序博客网 时间:2024/06/05 18:55

         今天学的知识点不多,但理解起来比较困难,如对象的引用、对象的传参。下面举个例:

public class Chuancan_2 {



public static void main(String[] args) {
int x=1;
Oo_1 m=new Oo_1();
m.age=3;

m=test(m,x);
System.out.print(m.age+"  "+x);
}
public static Oo_1 test(Oo_1 m,int x){
m.age=5;
x=2;

m=new Oo_1();
m.age=20;
return m;
}


}

0 0
原创粉丝点击