Monday 16 March 2015

Q 18) Difference Between this and super keywords




This :

·      It is used to resolve naming conflicts between local and instance                   variables.
·     We use this keyword to point instance variable of the current class.
·     This keyword is also called as reference variable which contains object         of the current class.
·     When the instance variable name is same, in that case we can refer this         keyword to differentiate form local and instance variables.


SUPER :

  •        Super keyword is used as a base class reference variable to refer the      base class instance variables and non static method.
  •    Super keyword is used to call the super class instance variable in            sub  class.

No comments:

Post a Comment