What is the role of @override function in java. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is the role of @override function in java.

What is the meaning of this function and how does it work? If as possible give the answer with example in simple way please.

16th Jan 2017, 7:24 PM
Dheerendra Kumar
Dheerendra Kumar - avatar
2 Answers
+ 7
It's not a function. @Override shows that you want to override base method. It is not required to use this attribute, but it's easier to read code with it. Also if you will make a mistake in method name/parameters compiler will show error instead of creating another function
16th Jan 2017, 9:15 PM
WittyBit
WittyBit - avatar
+ 1
here is an example that you may want to check to see difference or understand the meanings of overriding and overloading https://code.sololearn.com/c0awDMpDLukF/?ref=app
11th Sep 2017, 3:04 PM
Melih Melik Sonmez
Melih Melik Sonmez - avatar