❮ Previous Next ❯

Java this keyword

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

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

Uses of this keyword:

❮ Previous Next ❯


Popular Links

Contact Us

address Plot No-741,2ND Floor
Opp. Bhagabati Temple,Jayadev Vihar
      Email: info@silantechnology.com
      Phone: 0674-2361252
39877, sundale dr, apt#101, Fremont, California 94538, USA
       Phone: +1(262)388-7619

facebook twitter google linked in

© 2018 Silan Technology. All Rights Reserved