Overloading: Multiple methods with same name but different parameters (compile-time polymorphism)
Overriding: Subclass provides specific implementation of parent class method (runtime polymorphism)
// Overloading
class Calculator {
int add(int a, int b) { return a + b; }
double add(double a, double b) { return a + b; }
}
// Overriding
class Shape {
void draw() { System.out.println("Drawing shape"); }
}
class Circle extends Shape {
@Override
void draw() { System.out.println("Drawing circle"); }
}
Rewriting in plainer words…
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.