Java, how to use methods and constructor of the extended class

Let’s suppose you are working on class Extending which extends the class Base.
Now you want to overwrite method setName(name) but you also want to execute the code within the overwritten method plus some custom code, then just call within the Extending class

super.setName()
customcode();

If you need to do the same for the constructor just call

super()

if the extended constructor has no arguments, otherwise

super(name, surname, age, sex)
Annunci