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.
На этой странице сайта вы можете посмотреть видео онлайн Learn Java Programming - @Override Annotation Tutorial длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Daniel Ross 05 Август 2015, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 11,030 раз и оно понравилось 186 зрителям. Приятного просмотра!