+ 2
What is different in method overloading and method overriding
Question in Java
2 Respostas
+ 5
method overloading is a method with the same name but different input arguments such as
public int add(int a, int b){
return a + b;
}
public int add(int a, int b, int c){
return a+b + c;
}
method overriding is when you basically replace the code for a method without removing the original code. So it can be specific to a given class or whatever. a good and common example of this is the toString method.