0
The difference between method overloading and metgod overriding
2 Respostas
+ 3
Overriding means that a subclasses overrides a method for it's uses, overloading means that there's a method with the same name as another, but taking other arguments.
Overriding:
class Animal{
public void say (){
System.out.println("Hi");
}
}
class Dog extends Animal {
@Override
public void say (){
System.out.println("Woof"):
}
}
Overloading:
class Main {
public void say (){
System.out.println("Hi");
}
public void say(String s){
System.out.println(s);
}
}
+ 2
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