@ Override is a pseudoCode, Indicates rewriting (of course not writing), but writing has the following advantages:
1. It can be used as a comment for easy reading
2. the compiler can verify for you whether the method name under @ override is all in your parent class. If not, an error is returned.
For example, if you haven't written @ override and the method name below is wrong, then your compiler can pass (it thinks this method is the method added in your subclass)
Example:
When override oncreate of the parent class, adding @ override before the method can help you check the correctness of the method. For example,Public VoidOncreate (bundle savedinstancestate ){.......} This method is correct. If you writePublic VoidOncreate (bundle savedinstancestate ){.......} In this way, the compiler returns the following error -- the method oncreate (bundle) of Type helloworld must override or implement a supertype method, to ensure that you override the oncreate method correctly. (Because oncreate should be oncreate)
If you do not add @ override, the compiler will not detect the error, but will think that you have defined a new method oncreate.