this Keyword in Java

what is this keyword in java?

this is a reference variable that refers to the current object.

this Keyword usage:
1. To refer current class instance variable
2. To invoke current class method
3. To invoke current class constructor
4. this can be passed as an argument in the method call
5. this can be used to return the current class instance from the method
6. this can be passed as an argument in the constructor call

To get more details please watch below youtube video and Subscribe the channel.


No comments:

Post a Comment