对象的引用
2015-08-11 20:15
239 查看
今天学的知识点不多,但理解起来比较困难,如对象的引用、对象的传参。下面举个例:
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;
}
}
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;
}
}
相关文章推荐
- AspNetPager实现真分页+多种样式
- nginx学习教程初级篇
- c++类实现字符串的基本函数
- 29-HTML-10-HTML(框架)
- C#获取注册表所有写入数据的名称及值
- D5
- hibernate通过判断参数动态组合Hql语句,生成基本通用查询
- _11_foreach遍历__
- _10_do_while循环__
- _09_while循环__
- _08_for循环--输出9x9乘法表
- _07_Switch_判断
- sql之截取字符串函数
- 一种瀑布流效果的实现
- _06_命令行参数_if判断
- _08_for循环--输出9x9乘法表
- _07_Switch_判断
- 《公开课2》:Tiny服务及CEP深入剖析——直播QQ群:228977971
- 29-HTML-09-HTML(超链接_2)
- Java 多线程实现的两种方式