I have an abstract class like so:
abstract class Player {
//some stuff
public abstract String getName();
}
and in one of the subclasses I am implementing (and overloading / overriding as well? Here is where I am not sure) the function getName() like so by typing out the whole function again:
public String getName(){
return "John";
}
but I can also in my subclass simply write "getName()", press enter and my IDE automatically fills out the following code for me, which also works (if I change null to "John" in this case):
@Override
public String getName(){
return null;
}
Obviously since it states "Override" I am here overriding the function in the abstract superclass. But am I not already overriding the function even without putting "@Override" above the function?
What I am saying is: I have an abstract function, so it is only implemented in a subclass and not in the superclass itself. Doesn't this mean that by implementing it I am automatically overriding it as well, since it has no implementation in the superclass to begin with? Why should I write @Override then? Or am I just "overloading" if I don't put "@Override" in there?