Im new to android development. I would like to know why do we have to precede every overriden method with @Override annotation in android ?. In regular java this is not a requirement.
Please Help
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
@Overridenotation is used so the compiler can warn you if the method-signature isn’t the same as the super class method-signature. It can warn you about tedious bugs, and it is not required in Android, but it is good practice both in “normal” Java programming and Android Programming.If you in “normal” Java had misspelled the toString-method e.g.
public String toString(int n) {...}and you had the@Overridethe compiler will warn you because you are not overriding a method in the superclass.