I'm sorry people are rude and downvote without explanation. SO used to be better than this...people were nicer to new SO members.
To answer your question, yes, there is a specification. That Object
is a superclass of every other class is mentioned in the API and in the Java Language Specification (JLS).
As a new Java programmer you should look in the API when you have questions about classes...that will tell you what you need to know, at least for your first few years programming in Java.
Oracle has a tutorial that will teach you the basics of Java, and there are numerous other resources on the web.
The purpose of @Override
is not to enable you to call the superclass' method. It provides a measure of compile-time safety by ensuring that the method annotated with @Override
actually overrides or implements a method in a supertype or a public method in Object
, as noted in the API. You can override a method without using the @Override
annotation, however, if the overridden method's signature changes in the future you probably won't notice until your code doesn't work as intended. It's much better to catch these sorts of issues at compile time. Also, @Override
helps other programmers understand your code.
Good luck!