What is “this” keyword in java?

Total Post:9

Points:45

 49  View(s)
Ratings:
Rate this:
  1. What is “this” keyword in java?

    Into the instance method or a constructor, this is a reference to the current object — the object whose method or constructor is being called.

    We can send to any member of the current object from within an instance method or a constructor by using this.

    • Usage of this keyword
    • Used to refer current class instance variable.
    • To invoke the current class constructor.
    • It’s can be passed as an argument in the method call.
    • It’s can be passed as an argument in the constructor call.
    • Used to return the current class instance.
    • Used to invoke current class method (implicitly)

Answer