What's the Need of '@override' in inheritance of Java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9

What's the Need of '@override' in inheritance of Java?

13th Nov 2017, 3:13 AM
VARUN KUMAR PADALA
VARUN KUMAR PADALA - avatar
7 Answers
+ 2
lol. Got it from my Java book. I program in Java all the time. So I keep it near me. I use it for programming Android. That was the best way that I understood it. Lol. I'll post a link to the book later, for you.
13th Nov 2017, 3:50 AM
Eric Geiger
Eric Geiger - avatar
+ 8
😀😂👏 kkk bro!
13th Nov 2017, 3:54 AM
VARUN KUMAR PADALA
VARUN KUMAR PADALA - avatar
+ 6
Thank u Eric Gieger for sharing ur knowledge with an useful example. I think its enough to learn about @override keyword after knowing ur answer.
13th Nov 2017, 3:43 AM
VARUN KUMAR PADALA
VARUN KUMAR PADALA - avatar
+ 4
essentially the sign itself is just to notify you (or another developer) that the class is being overridden. Otherwise, the point of overriding... I'll just give an example. think of the toString method. Every class has a toString method whether it defines it or not, or whether it inherits it through another class or not, it explicitly extends, because the object class defines a toString method. each class treating the toString differently on how it handles it. Like an ArrayList will provide a square bracket, comma delimited list of strings. So the point is that every class is doing the same thing, so that it has to be overridden, but is doing it in its own way.
13th Nov 2017, 3:38 AM
Eric Geiger
Eric Geiger - avatar
+ 4
Here is how I program in Android. They have some things they need to get worked out, but it's not bad. https://play.google.com/store/apps/details?id=com.besome.sketch
13th Nov 2017, 3:57 AM
Eric Geiger
Eric Geiger - avatar
+ 2
http://highered.mheducation.com/sites/007337606x/student_view0/index.html
23rd Jul 2018, 1:39 AM
Eric Geiger
Eric Geiger - avatar
+ 1
It is a marker annotation that can be used only on methods. A method annotated with @Override must override a method from a superclass. If it doesn’t, a compile-time error will result. It is used to ensure that a superclass method is actually overridden, and not simply overloaded.
20th Nov 2017, 10:30 AM
Wasula Benjamin
Wasula Benjamin - avatar