Super keyword is used to call base class’s method or constructor. If we inherite a class and that class doesn’t have default constructor then we can call base class’s overloaded constructor inside our class’s constructor using supe keyword.
class Java{
public Java(String title){
System.out.println(title);
}
}
class Android extends Java{
public Android(){
super("Hello from Android class using super");
}
}
Super keyword will call matching constructor of base class, which means if you pass 2 parameters to super keyword then it will call base class’s constructor having 2 parameters. If you call super keyword without parameters then it will call default constructor of base class.