Super Keyword
- Refer to this code sample.
class Monkey {
Monkey(){
}
}
class Man extends Monkey{
Man(){
Super();
}
}
Super = Super class
- The keyword super is used to call the constructor in the super class when you are in the sub class.
- When we are using the super keyword in a constructor of the sub class, the constructor of super class will run in the constructor of the sub class.
- We can access methods and variables in the super class using the keyword super.


Comments
Post a Comment