Annotations
We will now cover another important topic that will help us write better Java programs.
Annotations are a way in which we can add metadata to our programs. This metadata can include information such as the version of a class we are developing. This is useful in scenarios where a class is deprecated or where we are overriding a certain method. Such metadata is not part of the program itself, but can help us catch errors or offer guidance. Annotations have no direct effect on the operation of the code they annotate.
Let's look at a scenario. How do we ensure that we are overriding a certain method and not creating another completely different method? When overriding a method, a single mistake such as using a different return type will cause the method to not be overridden anymore. Such a mistake is easy to make but can lead to software bugs later on if not taken care of early in the software development stages. How, then, do we enforce overriding? The answer, as you might have already...