Dus*_*Sun 7 java this
在类构造函数中,我尝试使用:
if(theObject != null) this = theObject;
我搜索了数据库,如果记录存在,我使用theObject的Hibernate查询生成.
theObject
为什么我不能使用this?
this
Sid*_*Sid 17
这是因为'this'不是变量.它指的是当前的参考.如果你被允许重新分配'this',它将不再是'this',它将变成'那'.你不能做这个.
Abd*_*ahC 5
this不是变量,而是值.你不能this在表达式中使用左值.
归档时间:
15 年,3 月 前
查看次数:
602 次
最近记录:
13 年,2 月 前