There can be a lot of usage of this keyword. In java this is a reference variable that refers to the current object.
Consider the following source code:
class Test { public static void main(String[] args) { int x, y; //instance variables Test(int x, int y) // local variables { this.x=x; this.y=y; } } }
Here the instance and local variables are same. To differentiate which is instance variables and which is local variables, we use the keyword this. So the keyword this refers to the current object.
So this.x and this.y refers to instance variable
Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.
We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc