how does the @override work? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

how does the @override work?

23rd Jun 2016, 4:20 PM
Sparsh Agarwal
Sparsh Agarwal - avatar
4 Answers
+ 7
@override: Annotation to show a method is over ridden. Briefly, when a child class changes the behaviour of a super class method, it is said to override the method of super class. Also, one thing to keep in mind is while overriding method, return type and argument (method signature) must remain same.
23rd Jun 2016, 5:22 PM
Karshit Kumar
+ 3
if u remove @Override annotations from the child class,it won't affect the output ..
14th Jul 2016, 3:29 PM
AnsHuman Aaditya
AnsHuman Aaditya - avatar
+ 1
@overwrite is annotations used to explain that this method is overridden in child class. else it will be treated as child class's local method..
23rd Jun 2016, 7:02 PM
neel
neel - avatar
0
1 A child class can implement a parent class method based on it's requirement. 2 In anonymous class it is used as a way to extend an existing class on the fly. 3 In equals () method @override is used for semantically equality testing.
23rd Jun 2016, 7:38 PM
Kurien Varappettil
Kurien Varappettil - avatar