This is a very naiveish question, but here goes:
An overriden method from a base class will mean that calls to the sub class will call the derived, overriden method, correct?
Thus, if there is no override annotation, the method in the base class will be called. So the override method will serve purely to document the intent - call one version of a method over the other.
Is this the case?
This leads me to the following question:
What is the difference between an abstract class which 5-6 classes may derive from but the methods inherited in the derived classes are not overriden, and one class (Static or not being irrelevant), used by those 5-6 classes?
The @Override annotation is intended ONLY to catch errors at compilation time. It does not affect override behavior at runtime. The idea is that you give the compiler the chance to inform you that your method name or signature is wrong.
The override annotation is simply a marker to show the the method overrides a superclass method.
It being there has no effect at runtime. See here:
http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Override.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With