Learn Java Programming - @Override Annotation Tutorial

Veröffentlicht am: 05 August 2015
auf dem Kanal: 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.


Auf dieser Seite können Sie das Online-Video Learn Java Programming - @Override Annotation Tutorial mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Daniel Ross 05 August 2015 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 11,030 Mal angesehen und es wurde von 186 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!