第一个程序Method t = new Method();
==>Method()
{
this("dfasdfasffs",47); height = i; <--- i是成员变量
}Method(String s, int i)
{
this.s = s;
this.i = i;
i = 98; <--- 改变的是局部变量i,不是成员变量i System.out.println("this sucess");
}
s-->"dfasdfasffs"
i-->47
height --> 47
第二个程序Method t = new Method();
===> Method()
{
this("dfasdfasffs",47);
height = k;
}s--->"dfasdfasffs"
i--->47
k=98
height --> 98 Method(String s, int i)
{
this.s = s;
this.k = i;
k = 98; <--- k是成员变量
System.out.println("this sucess");
}
解决方案 »
- ActionForm得不到前台传的数据
- 自学spring时的一个奇怪的异常
- ant的问题com.sun.tools.xjc.XJCTask cannot be found
- 关于spring ioc 配置文件求助!!
- 怎么区别一个HTML页面中的多个TABLE
- [原创] 利用压缩网页来提升网站浏览速度
- 求助:jdbc连接oracle不上,报错No more data to read from socket!
- 兄弟们帮个忙,请看下面的代码,帮忙解决.......
- hibernate 关联查询 报not an association: Id
- 网络抓包,怎么用Java程序登录百度?
- java新手 请教:EJB最最基础的问题
- j2ee教程上The Duke's Bank Application,部署成功后,转帐和取款会出现错误,请教~
这两个变量实质性还是相同的哪!!!!!!
比如常见的class A {
private int x;
public int setX(int x) { //参数,局部
this.x //成员变量
= x; //局部
}
}