6 uses of 'this' keyword
06 uses of 'this' keyword:
1. Stroring current object reference.
2. Accessing non-static variables and methods.
3. Accessing other constructor of same class without creating new object.
4. Differentiating non-static variables memory from one object to other object of some class in constructor, non-static block and non-static method.
5. Differentiating non-static variables from a parameter or from a local variable if both have same name.
6. Sending current object as argument and return type to other methods of same or another class.
0 comments: