0

What's the difference between system.out.println("Name: " +getname()); and system.out.println("Name: " +super.getname()); ?

in the coded class, there is a super code. super(name, number, etc.)

13th Oct 2019, 3:34 PM
yasifa ana
1 Answer
+ 2
The keyword super means the super class. Class Mother{ } Class Child extends class Mother{ } Mother is the super class. Child is the subclass. Imagine both classes have a getName() method. Inside class Child: printing getName() would print the String from the method in this class. printing super.getName() would print the String from the method of class Mother.
15th Oct 2019, 2:39 PM
Denise Roßberg
Denise Roßberg - avatar