Videos
There is only one constructor in your super class, the default no argument constructor which is not explicitly defined within the class. Each of the subclass's constructors will invoke this constructor in the super class.
getRadius() and getArea() are just methods within the super class, they are not constructors. Remember that constructors always take the form of:
[access modifier] Class Name{}
So a constructor for the Circle class would look like:
public Circle(/*Arguments could go here */){
}
If there were more than one constructor in the super class, let's say:
public Circle(int radius){
//....
}
public Circle(double radius){
//....
}
The compiler would use the arguments to determine which constructor to call.
Constructor name will be the class name. You are talking about the methods there.
class classname{
classname(){// constructor name as class name.
}
}
Calling exactly super() is always redundant. It's explicitly doing what would be implicitly done otherwise. That's because if you omit a call to the super constructor, the no-argument super constructor will be invoked automatically anyway. Not to say that it's bad style; some people like being explicit.
However, where it becomes useful is when the super constructor takes arguments that you want to pass in from the subclass.
public class Animal {
private final String noise;
protected Animal(String noise) {
this.noise = noise;
}
public void makeNoise() {
System.out.println(noise);
}
}
public class Pig extends Animal {
public Pig() {
super("Oink");
}
}
super is used to call the constructor, methods and properties of parent class.