+ 2

Overriding or Overloading

In these classes makeSound method is Overrided or Overloaded? class Animal { public void makeSound(Animal a) { System.out.println("Grr..."); } } class Cat extends Animal { public void makeSound(Cat a) { System.out.println("Meow"); } }

14th Feb 2017, 10:54 AM
Mohammad Reza Moosaei
Mohammad Reza Moosaei - avatar
6 Respostas
+ 4
overridden method. you can say ... any two methods with same (name,parameters and return type) we will call it overridden method. if any deference in parameters or return type but with same name, it means overloaded method.
2nd Mar 2017, 1:20 AM
Faris Alhodali
Faris Alhodali - avatar
+ 3
The Cat class it's overriding the method makeSound inherited from class Animal. In this case changes de text "Grr..." to "Meow" from class Animal that is printed when the method is called.
15th Apr 2017, 12:29 AM
Ismail
Ismail - avatar
+ 2
simple overriding
14th Feb 2017, 10:41 AM
Abdur-Rahmaan Janhangeer
Abdur-Rahmaan Janhangeer - avatar
+ 2
Thanks sir Melissa Melik
14th Sep 2017, 2:00 AM
Faris Alhodali
Faris Alhodali - 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, 2:50 PM
Melih Melik Sonmez
Melih Melik Sonmez - avatar
0
Overriding using covariant returntypes
20th Feb 2017, 4:51 AM
Harshada Garse
Harshada Garse - avatar