Alright. Remeber Java is obect-oriented?
So classes are some sort of "objects" that have methods and attributes (variables) you think they need, say your class boats needs to have a name, so you declare a variable for name called NameOfBoat.

Some objects are just one entire category of other objects. If you think about a boat, there are several types of boats: fishing boats, carrier boats, battleships. So the class or object "boat" is the most basic, the blueprint for all the type of boats. In java you can have another class (child) like carrier boat inherit the attribues and methods from its parent (class "boat"), through a declaration called extends followed by the parent class.

This enables you to use the methods and attributes of the parent class, without writting code for it.

You might want to review other terms related to inheritance like "super()" or "this." or "super." and "protected".

So sometimes the parent's got a method which is no longer good for the child. What you'd like to achieve with that method is entirely different. so what you do is that you type in @override and below that you declare the method thats on the parent that you'd like to change.

I tried to make it short. I hope this gives you an idea.

August 11th, 2013, 04:13 AM

GregBrannon

Re: @override

It might be helpful to read this lesson on annotations. The 4th page in that trail discusses the @Override annotation which says:

"@Override informs the compiler that the element is meant to override an element declared in a superclass. While it is not required to use this annotation when overriding a method, it helps to prevent errors. If a method marked with @Override fails to correctly override a method in one of its superclasses, the compiler generates an error."

Some IDEs check annotations before compile time and will let you know if the annotation is appropriate, so they can be used as a pre-check of the code's syntax.