Discussion Locked
0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
what is the use of "this" in java programming language?
1 reply
by wjlarue
The 'this' keyword is typically used in object instance method or constructor to refer to the current object (can also 0be used in the initializer of an instance variable of a class). I like to think of it as a short cut that keeps from typing long object names.
In the following example, this refers to the newly created MyObject object, and assigns values to three properties:
function MyObject(property1, property2, property3)
{
this.property1= property1;
this.property2= property2; this.property3= property3;
}
The keyword 'me' in Visual Basic would be an equivalent.
Hope this explains it.
This discussion is closed to new replies.
Trending Desktop posts
Sort by Trending
0 helpful
2 replies
Question
Floppy drive wont work on my 486
0 helpful
1 reply
Discussion
How to make light speed agent go away
0 helpful
4 replies
Discussion Locked
Ryzen 7 7700
0 helpful
2 replies
Question Locked
Issue fully resetting my PC
0 helpful
4 replies