+ 7
What is the use of this keyword ?
5 Answers
+ 25
this keyword is used to refer the current object
//I saw its use in getter , setter & constructors to initialize the object or take out values of instance members of that object
https://www.javatpoint.com/this-keyword
+ 3
to specify the CURRENT CLASS variable
this.apple
nothing else (kinda, most of the time)
+ 2
In Android it is used to refer to your actual activity/fragment without the need to write it out.
0
Think about it like this. Letās say that YOU, as a person, are a member of the Person class. You would refer to yourself as āmeā, right? And that expresses that you are referring to your own person, not some other person, or persons in general. Thatās what āthisā is. It is a specific instance of a class referring to itself. (In VB, the functional sister-language of C#, the keyword āmeā is used instead of āthisā.)