Learn Java Programming - @Override Annotation Tutorial

Publié le: 05 août 2015
sur la chaîne: Daniel Ross
11,030
186

The @Override is an annotation, an annotation does not change the way your program works, but rather it flags the compiler to be on the lookup for a special condition. When you override a method in a subclass it is a good idea to include the @Override annotation on the line before the method signature. The @Override annotation flags the compiler that the following method is overriding a method in a superclass. If that method does not exist in the superclass, the compiler will generate an error. Discovering an error when overriding a method saves a ton of time, especially if the overloaded method has a small typo in the name. An even better reason for including the @Override is flag someone else who is looking at your code that the method is in fact a overridden method. Without the annotation, the only way to know would be to peck and hunt through the food chain of superclasses. I personally absolutely love it when I see the @Override in Java code. It tells me right off the bat that the programmer who wrote the class had the foresight and took the time to be thorough.


Sur cette page du site, vous pouvez voir la vidéo en ligne Learn Java Programming - @Override Annotation Tutorial durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Daniel Ross 05 août 2015, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 11,030 fois et il a aimé 186 téléspectateurs. Bon visionnage!