Super keyword
It is utilized inside a sub-class technique definition to call a strategy characterized in the super class. Private techniques for the super-class can't be called. Just open and secured techniques can be called by the super catchphrase. It is additionally utilized by class constructors to summon constructors of its parent classUse of java super Keyword
- super can be utilized to allude prompt parent class example variable.
- super can be utilized to summon quick parent class strategy.
- super() can be utilized to conjure quick parent class constructor.
Example
_________________________________________________________________________________public class human
{
public int a;
public a()
{
System.out.println("variable is" + this.a);
}
}
public class student extends human
{
public a()
{
System.out.println("variable is" + super.a);
}
}
_________________________________________________________________________________super is used to access the variable of parent class when inheritance is done between the classes.
Next lecture Previous Lecture
0 Comments
Your Comment is Submitted