-10

I have been looking around on Google and StackOverFlow and I have not been able to find a good SIMPLE definition for:

@Override when it is used.

Can someone help me find a very simple definition for this?

Thanks.

Colin Koenig
  • 65
  • 1
  • 3
  • 15
  • https://docs.oracle.com/javase/tutorial/java/IandI/override.html? – Jashaszun Jul 27 '15 at 20:22
  • ...whenever you override a method you usually annotate it with `@Override`; it's a way Java has to indicate that a method is intended to override a method declaration without using an explicit keyword like, for instance, C# – x80486 Jul 27 '15 at 20:22
  • Do you know what overriding is? Without this knowledge it would be hard to understand purpose of this annotation. – Pshemo Jul 27 '15 at 20:49

2 Answers2

2

@Override annotation informs the compiler that the element is meant to override an element declared in a superclass. Java tutorials helps. Here is java tutorial on Overriding

kosa
  • 65,990
  • 13
  • 130
  • 167
  • Maybe even a bit simpler would be nice. Keep in mind this is for the total beginner. Thanks! – Colin Koenig Jul 27 '15 at 20:24
  • @ColinKoenig: In general I feel oracle documentation is the easy to understand one comparing with others. Two links in this answer should help you. – kosa Jul 27 '15 at 20:24
  • 1
    @ColinKoenig Understanding the `Override` annotation and why it's useful requires knowledge of the object orientated programming paradigm, and inheritance in specific, so there's no explanation that's understandable to the 'complete beginner'. You'll need to know at least the basic concepts of what I just mentioned in order to grasp the annotation's usefulness. – Emile Pels Jul 27 '15 at 20:26
0

The @Override annotation is optional. It indicates that this is expected to be overriding. If you misspell/or any scenario (in which it is not been overridden), the compiler will warn you.

PS: You should search on tutorials a bit more!

XOR-Manik
  • 493
  • 1
  • 4
  • 19