您的位置:首页 > 编程语言 > Java开发

java this

2016-08-05 18:43 316 查看
this 代表什么

this 应用场景

When used as a primary expression, the keyword
this
denotes a value that is a reference to the object for which the instance method or default method was invoked , or to the object being constructed. The value denoted by
this
in a lambda body is the same as the value denoted by
this
in the surrounding context.

注意点:

this 是对象的引用

The keyword
this
may be used only in the following contexts:

in the body of an instance method or default method

in the body of a constructor of a class

in an instance initializer of a class

in the initializer of an instance variable of a class

to denote a receiver parameter
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: