+ 7

Why do we need to use the annotation override?

When I create two class. One class abstract & abstract class have a method. another class have a same namd of method like as abstract method. Another class extends abstract class but I don't use override annotation, Sometimes it confused me.

27th Feb 2019, 5:33 AM
Nasir❤
Nasir❤ - avatar
1 ответ
+ 7
The Override annotation allows the compiler to check that you have in fact overridden (or implemented) a method when that was your intent. You may have the signature wrong, for example. The second purpose is documentation. Your code is easier to read if overridden methods are clearly marked. This annotation is not required, but it is a good style.
27th Feb 2019, 6:35 AM
Nasir❤
Nasir❤ - avatar