📜  “this”关键字的用法 - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:58.636000             🧑  作者: Mango

代码示例1
There can be a lot of usage of java this keyword. In java, this is a reference variable that refers to the current object. 

Here is given the 6 usage of java this keyword.

this can be used to refer current class instance variable.
this can be used to invoke current class method (implicitly)
this() can be used to invoke current class constructor.
this can be passed as an argument in the method call.
this can be passed as argument in the constructor call.
this can be used to return the current class instance from the method.