In the morning with the Jsp&servlet study note to learn JSP, after using Eclipse to create a servlet class, found that automatically created classes and books compared to the Doget method, the front of less @override, So I think the eclipse automatically created something that should not have a grammatical problem, if there is no grammatical problem, then why should the author add @override, what role does he have, with such doubts
@override have the role of annotated documents, a little bit like chicken
But it's a very human feature for programmers who are careless.
If you want to rewrite the method of the parent class, such as the ToString () method, precede the overloaded method with @override, so that the system can help you check the correctness of the method when compiling.
As follows
@Override
Public String toString () {...} That's right
If ToString is written as ToString
@Override
Public String ToString () {...} The compiler can detect that this is wrong, reminding you to correct
And if you don't add @override
Public String ToString () {...} So that the compiler will not error, it will be considered as a new method you add in the class
So be careful when programming, not all the wrong system can find
Learn the role of java--@override starting from 0