Pages

Super And This

Super And This
This Keyword Definition

This is a keyword. This is a reference variable that referes to the current object.

Usage of This Keyword
  1. This Keyword can be used to refer current class instance variable
  2. This() can be used to invoke current class constructor.
  3. This Keyword can be used to invoke current class methods.
  4. This can be passed as an argument in the method call.
  5. This can be passed as an argument in the constructor call.
  6. This Keyword can also be used to return the current class instance.
Super Keyword Definition

Super is a keyword. Super is a reference variable that is used to refer immediate parent class object.

Usage of Super Keyword
  1. Super is used to refer immediate parent class instance variable.
  2. Super() is used to invoke immediate parent class constructor.
  3. Super Keyword is used to invoke immediate parent class methods.