void meth2 (){...} in classe c1 and void math2 (int a){...} in classe c2 extends c1 is it overloading or over riding?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

void meth2 (){...} in classe c1 and void math2 (int a){...} in classe c2 extends c1 is it overloading or over riding??

2nd Dec 2016, 6:14 PM
mar oua
mar oua - avatar
2 Answers
+ 2
it is overriding because the implementation is different as opposed to the parameters being different as is the case for overloading. when you inherit a class from another class in java, you override the superclass's methods (if you define the methods with their own implementation). this is much simpler than in other languages so take advantage of it!
2nd Dec 2016, 6:33 PM
NICKALL [EP]
NICKALL [EP] - avatar
0
thunk y :)
2nd Dec 2016, 9:24 PM
mar oua
mar oua - avatar