Welcome to the Treehouse Community
Looking to learn something new?
what is "@override" in the java file of the app?
Jean Simmons7,615 Points
I've actually had this question before. @Override is an annotation that [isn't necessarily needed as long as you continue to accurately key the correct API for the supertype method you wish to override. The potential hazard is that your app will successfully compile, execute and call the supertype method on a superclass or interface which, although it may not cause your application to crash, would provide you with results that you would not expect.] A college professor told me this once after I tried compiling a project several times in Netbeans and couldn't get it to work because Netbeans kept expecting the use of @Override and started adding annotations to my code that I didn't quite understand.
If you check StackOverflow you can find some good answers to give you a better idea: http://stackoverflow.com/questions/4341432/what-does-override-mean
You have lots of ready made classes available to you, and these classes have ready made methods. For example, I'm looking at my project and I see that my MainActivity extends AppCompatActivity. If I go into AppCompatActivity I see it contains a method called onCreate and it has a few lines of code in it. Unfortunately it doesn't do exactly what I want it to do.
In my MainActivity, by using @override on onCreate I can make changes to the onCreate method so it's my own customised version of what was in AppCompatActivity.