What is "this" keyword in java? Explain

It is a reference variable that refers to the current object. It can be used as follows:

  • To refer instance variable of class
  • To invoke class constructor
  • Passed as an argument in method call
  • Passed as an argument in the constructor call
  • Used to return a class instance

Suggest An Answer

No suggestions avaliable!

Related Interview Questions