What is “this” keyword in java?

Last updated:9/22/2020 5:06:52 PM

1 Answers

Sanat Shukla
Sanat Shukla

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