I\'m trying to get the hang of inheritance in Java and have learnt that when overriding methods (and hiding fields) in sub classes, they can still be accessed from the super
overriding means redefining a method from the superclass inside a subclass with identical method signature. In your case, the getTyreCost()
method has not been overridden, you have not redefined the method in your subclass, so no need to use super.getTyreCost()
, only getTyreCost()
will do(just like super.getTyreCost()
will do the same way). super
keyword is used when a method has been overridden, and you want a method call from within your subclass to be implemented in the superclass.