The super keyword enables a subclass to interact with its superclass, either by calling its constructor or accessing its members.
It is used to call the constructor of the immediate superclass. When used this way, it must be the first statement in the subclass constructor.
public AlarmClock() extends Clock {
super();
// ^ Calls the superclass constructor
alarmHrs = 0;
alarmMins = 0;
}
It allows access to a member (field or method) of the superclass. Unlike in the constructor, it can be called at any point within the method.
public AlarmClock() extends Clock {
public void tick() {
super.tick();
// ^ Calls the tick method of the superclass
}
}