The super() is essential when the parent class constructor takes any parameter
The super() is not necessary when the parent class constructor takes no parameter because super() will be already specified implicitly.
Look at the code:
public class A{
int a;
A(int a){
this.a=a;
//Constructor of parent class which requires a parameter
}
}
public class B extends A{
int b;
B(int a, int b){
super(a);
this.b=b;
//here super(a) is used to pass the parameter required by the
constructor of the parent class A.
}
}
In other words, whenever you create an object for the child class. First, the constructor of the parent class will be called followed by the constructor of the child class. So it is necessary to pass the parameters required by the parent class constructor from the child class constructor using super() method.
Hope it helps!
Please don't forget to upvote