使用Java这个关键字 [英] Usage of Java this keyword

查看:118
本文介绍了使用Java这个关键字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在类构造函数中,我正在尝试使用:

In a class constructor, I am trying to use:

if(theObject != null)
    this = theObject; 

我搜索数据库,如果记录存在,我使用 theObject 由Hibernate Query生成。

I search the database and if the record exists, I use theObject generated by Hibernate Query.

为什么我不能使用这个

推荐答案

不是变量,而是值。您不能将作为表达式中的左值。

this is not a variable, but a value. You cannot have this as the lvalue in an expression.

这篇关于使用Java这个关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆